d3dx9: Fix D3DXQuaternionNormalize to make tests pass in Windows.

This commit is contained in:
David Adam 2009-07-17 11:32:38 +02:00 committed by Alexandre Julliard
parent 831d6b5886
commit 0788ac38ab
2 changed files with 7 additions and 18 deletions

View File

@ -1241,21 +1241,14 @@ D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST D3DXQ
FLOAT norm; FLOAT norm;
norm = D3DXQuaternionLength(pq); norm = D3DXQuaternionLength(pq);
if ( !norm )
{ out.x = pq->x / norm;
out.x = 0.0f; out.y = pq->y / norm;
out.y = 0.0f; out.z = pq->z / norm;
out.z = 0.0f; out.w = pq->w / norm;
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;
}
*pout=out; *pout=out;
return pout; return pout;
} }

View File

@ -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; 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); D3DXQuaternionNormalize(&gotquat,&q);
expect_vec4(expectedquat,gotquat); 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___________________*/ /*_______________D3DXQuaternionRotationAxis___________________*/
axis.x = 2.0f; axis.y = 7.0; axis.z = 13.0f; axis.x = 2.0f; axis.y = 7.0; axis.z = 13.0f;