http://bugs.winehq.org/show_bug.cgi?id=30786
--- Comment #4 from nozomi kodama nozomi.kodama@yahoo.com 2012-06-06 23:26:26 CDT --- Comment on attachment 40421 --> http://bugs.winehq.org/attachment.cgi?id=40421 Implemention od D3DXQuaternionSquadSetup
From 667f9f7e55d1e1505f6af2d557f891b6b6575a31 Mon Sep 17 00:00:00 2001 From: Nozomi Kodama Nozomi.Kodama@yahoo.com Date: Thu, 7 Jun 2012 13:16:16 +0800 Subject: Implement D3DXQuaternionSquadSetup
dlls/d3dx9_36/d3dx9_36.spec | 2 +- dlls/d3dx9_36/math.c | 76 +++++++++++++++++++++++++++++++++++++++++++ include/d3dx9math.h | 1 + 3 files changed, 78 insertions(+), 1 deletions(-)
diff --git a/dlls/d3dx9_36/d3dx9_36.spec b/dlls/d3dx9_36/d3dx9_36.spec index 8d7143e..2fbd403 100644 --- a/dlls/d3dx9_36/d3dx9_36.spec +++ b/dlls/d3dx9_36/d3dx9_36.spec @@ -252,7 +252,7 @@ @ stdcall D3DXQuaternionRotationYawPitchRoll(ptr float float float) @ stdcall D3DXQuaternionSlerp(ptr ptr ptr float) @ stdcall D3DXQuaternionSquad(ptr ptr ptr ptr ptr float) -@ stub D3DXQuaternionSquadSetup(ptr ptr ptr ptr ptr ptr ptr) +@ stdcall D3DXQuaternionSquadSetup(ptr ptr ptr ptr ptr ptr ptr) @ stdcall D3DXQuaternionToAxisAngle(ptr ptr ptr) @ stub D3DXRectPatchSize(ptr ptr ptr) @ stub D3DXSaveMeshHierarchyToFileA(ptr long ptr ptr ptr) diff --git a/dlls/d3dx9_36/math.c b/dlls/d3dx9_36/math.c index 10a6cb9..38e44f5 100644 --- a/dlls/d3dx9_36/math.c +++ b/dlls/d3dx9_36/math.c @@ -1375,6 +1375,82 @@ D3DXQUATERNION* WINAPI D3DXQuaternionSquad(D3DXQUATERNION *pout, CONST D3DXQUATE return pout; }
+static D3DXQUATERNION sum(D3DXQUATERNION q1, D3DXQUATERNION q2) +{
- D3DXQUATERNION temp;
- temp.x = q1.x + q2.x;
- temp.y = q1.y + q2.y;
- temp.z = q1.z + q2.z;
- temp.w = q1.w + q2.w;
- return temp;
+}
+static D3DXQUATERNION diff(D3DXQUATERNION q1, D3DXQUATERNION q2) +{
- D3DXQUATERNION temp;
- temp.x = q1.x - q2.x;
- temp.y = q1.y - q2.y;
- temp.z = q1.z - q2.z;
- temp.w = q1.w - q2.w;
- return temp;
+}
+void WINAPI D3DXQuaternionSquadSetup(D3DXQUATERNION *paout, D3DXQUATERNION *pbout, D3DXQUATERNION *pcout, CONST D3DXQUATERNION *pq0, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, CONST D3DXQUATERNION *pq3) +{
- D3DXQUATERNION pqt0, pqt1, pqt2, pqt3, q1, q2, temp, temp0, temp2, temp3, zero;
- zero.x = 0.0f;
- zero.y = 0.0f;
- zero.z = 0.0f;
- zero.w = 0.0f;
- pqt0 = *pq0;
- pqt1 = *pq1;
- pqt2 = *pq2;
- pqt3 = *pq3;
- q1 = sum(pqt0, pqt1);
- q2 = diff(pqt0, pqt1);
- if( D3DXQuaternionLengthSq(&q1) < D3DXQuaternionLengthSq(&q2) ) temp0 = diff(zero, pqt0);
- else temp0 = pqt0;
- q1 = sum(pqt1, pqt2);
- q2 = diff(pqt1, pqt2);
- if( D3DXQuaternionLengthSq(&q1) < D3DXQuaternionLengthSq(&q2) ) temp2 = diff(zero, pqt2);
- else temp2 = pqt2;
- q1 = sum(pqt2, pqt3);
- q2 = diff(pqt2, pqt3);
- if( D3DXQuaternionLengthSq(&q1) < D3DXQuaternionLengthSq(&q2) ) temp3 = diff(zero, pqt3);
- else temp3 = pqt3;
- D3DXQuaternionInverse(&temp, &pqt1);
- D3DXQuaternionMultiply(&q1, &temp, &temp0);
- D3DXQuaternionLn(&q1, &q1);
- D3DXQuaternionMultiply(&q2, &temp, &temp2);
- temp = sum(q1, q2);
- temp.x *= -0.25f; temp.y *= -0.25f; temp.z *= -0.25f; temp.w *= -0.25f;
- D3DXQuaternionExp(&temp, &temp);
- D3DXQuaternionMultiply(paout, &pqt1, &temp);
- D3DXQuaternionInverse(&temp, &temp2);
- D3DXQuaternionMultiply(&q1, &temp, &pqt1);
- D3DXQuaternionLn(&q1, &q1);
- D3DXQuaternionMultiply(&q2, &temp, &temp3);
- temp = sum(q1, q2);
- temp.x *= -0.25f; temp.y *= -0.25f; temp.z *= -0.25f; temp.w *= -0.25f;
- D3DXQuaternionExp(&temp, &temp);
- D3DXQuaternionMultiply(pbout, &temp2, &temp);
- *pcout = temp2;
- return;
+}
void WINAPI D3DXQuaternionToAxisAngle(CONST D3DXQUATERNION *pq, D3DXVECTOR3 *paxis, FLOAT *pangle) { paxis->x = pq->x; diff --git a/include/d3dx9math.h b/include/d3dx9math.h index c31b652..a1fd70a 100644 --- a/include/d3dx9math.h +++ b/include/d3dx9math.h @@ -337,6 +337,7 @@ D3DXQUATERNION* WINAPI D3DXQuaternionRotationMatrix(D3DXQUATERNION *pout, CONST D3DXQUATERNION* WINAPI D3DXQuaternionRotationYawPitchRoll(D3DXQUATERNION *pout, FLOAT yaw, FLOAT pitch, FLOAT roll); D3DXQUATERNION* WINAPI D3DXQuaternionSlerp(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, FLOAT t); D3DXQUATERNION* WINAPI D3DXQuaternionSquad(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, CONST D3DXQUATERNION *pq3, CONST D3DXQUATERNION *pq4, FLOAT t); +void WINAPI D3DXQuaternionSquadSetup(D3DXQUATERNION *paout, D3DXQUATERNION *pbout, D3DXQUATERNION *pcout, CONST D3DXQUATERNION *pq0, CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2, CONST D3DXQUATERNION *pq3); void WINAPI D3DXQuaternionToAxisAngle(CONST D3DXQUATERNION *pq, D3DXVECTOR3 *paxis, FLOAT *pangle);
D3DXVECTOR2* WINAPI D3DXVec2BaryCentric(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, CONST D3DXVECTOR2 *pv3, FLOAT f, FLOAT g);
1.7.9