Commit 831d6b58 authored by David Adam's avatar David Adam Committed by Alexandre Julliard

d3dx9: Fix D3DXQuaternionInverse to make tests pass in Windows.

parent f59e41e8
......@@ -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;
}
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment