David Adam : d3dx9: Fix D3DXQuaternionInverse to make tests pass in Windows .

Alexandre Julliard julliard at winehq.org
Fri Jul 17 09:03:32 CDT 2009


Module: wine
Branch: master
Commit: 831d6b588663b355ccbefcffc239f818d85b98e2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=831d6b588663b355ccbefcffc239f818d85b98e2

Author: David Adam <david.adam.cnrs at gmail.com>
Date:   Fri Jul 17 11:30:29 2009 +0200

d3dx9: Fix D3DXQuaternionInverse to make tests pass in Windows.

---

 dlls/d3dx9_36/math.c       |   22 ++++++++--------------
 dlls/d3dx9_36/tests/math.c |    7 ++++---
 2 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/dlls/d3dx9_36/math.c b/dlls/d3dx9_36/math.c
index f80a5db..bcb2006 100644
--- a/dlls/d3dx9_36/math.c
+++ b/dlls/d3dx9_36/math.c
@@ -1182,23 +1182,17 @@ D3DXQUATERNION* WINAPI D3DXQuaternionExp(D3DXQUATERNION *pout, CONST D3DXQUATERN
 
 D3DXQUATERNION* WINAPI D3DXQuaternionInverse(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq)
 {
+    D3DXQUATERNION out;
     FLOAT norm;
 
     norm = D3DXQuaternionLengthSq(pq);
-    if ( !norm )
-    {
-     pout->x = 0.0f;
-     pout->y = 0.0f;
-     pout->z = 0.0f;
-     pout->w = 0.0f;
-    }
-    else
-    {
-     pout->x = -pq->x / norm;
-     pout->y = -pq->y / norm;
-     pout->z = -pq->z / norm;
-     pout->w = pq->w / norm;
-    }
+
+    out.x = -pq->x / norm;
+    out.y = -pq->y / norm;
+    out.z = -pq->z / norm;
+    out.w = pq->w / norm;
+
+    *pout =out;
     return pout;
 }
 
diff --git a/dlls/d3dx9_36/tests/math.c b/dlls/d3dx9_36/tests/math.c
index 722198a..cdbfc1d 100644
--- a/dlls/d3dx9_36/tests/math.c
+++ b/dlls/d3dx9_36/tests/math.c
@@ -699,11 +699,12 @@ static void D3DXQuaternionTest(void)
     expectedquat.x = -1.0f/121.0f; expectedquat.y = -2.0f/121.0f; expectedquat.z = -4.0f/121.0f; expectedquat.w = 10.0f/121.0f;
     D3DXQuaternionInverse(&gotquat,&q);
     expect_vec4(expectedquat,gotquat);
-    /* test the null quaternion */
-    expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 0.0f;
-    D3DXQuaternionInverse(&gotquat,&nul);
+
+    expectedquat.x = 1.0f; expectedquat.y = 2.0f; expectedquat.z = 4.0f; expectedquat.w = 10.0f;
+    D3DXQuaternionInverse(&gotquat,&gotquat);
     expect_vec4(expectedquat,gotquat);
 
+
 /*_______________D3DXQuaternionIsIdentity________________*/
     s.x = 0.0f; s.y = 0.0f; s.z = 0.0f; s.w = 1.0f;
     expectedbool = TRUE;




More information about the wine-cvs mailing list