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

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


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

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

d3dx9: Fix D3DXQuaternionNormalize to make tests pass in Windows.

---

 dlls/d3dx9_36/math.c       |   21 +++++++--------------
 dlls/d3dx9_36/tests/math.c |    4 ----
 2 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/dlls/d3dx9_36/math.c b/dlls/d3dx9_36/math.c
index bcb2006..30f7ec9 100644
--- a/dlls/d3dx9_36/math.c
+++ b/dlls/d3dx9_36/math.c
@@ -1241,21 +1241,14 @@ D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST D3DXQ
     FLOAT norm;
 
     norm = D3DXQuaternionLength(pq);
-    if ( !norm )
-    {
-     out.x = 0.0f;
-     out.y = 0.0f;
-     out.z = 0.0f;
-     out.w = 0.0f;
-    }
-    else
-    {
-     out.x = pq->x / norm;
-     out.y = pq->y / norm;
-     out.z = pq->z / norm;
-     out.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 cdbfc1d..6e9f25d 100644
--- a/dlls/d3dx9_36/tests/math.c
+++ b/dlls/d3dx9_36/tests/math.c
@@ -762,10 +762,6 @@ static void D3DXQuaternionTest(void)
     expectedquat.x = 1.0f/11.0f; expectedquat.y = 2.0f/11.0f; expectedquat.z = 4.0f/11.0f; expectedquat.w = 10.0f/11.0f;
     D3DXQuaternionNormalize(&gotquat,&q);
     expect_vec4(expectedquat,gotquat);
-    /* Test the nul quaternion */
-    expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 0.0f;
-    D3DXQuaternionNormalize(&gotquat,&nul);
-    expect_vec4(expectedquat,gotquat);
 
 /*_______________D3DXQuaternionRotationAxis___________________*/
     axis.x = 2.0f; axis.y = 7.0; axis.z = 13.0f;




More information about the wine-cvs mailing list