From 0788ac38ab10b44278ab8da5432b3ffb44089f98 Mon Sep 17 00:00:00 2001 From: David Adam Date: Fri, 17 Jul 2009 11:32:38 +0200 Subject: [PATCH] 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 bcb20062cfa..30f7ec9bf92 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 cdbfc1d3cf9..6e9f25da7de 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;