d3dx8: Implement D3DXQuaternionIdentity.

This commit is contained in:
David Adam 2007-10-18 21:01:24 +02:00 committed by Alexandre Julliard
parent 77f5d4c88c
commit 4be363ac80
2 changed files with 18 additions and 0 deletions

View File

@ -62,6 +62,14 @@ static void D3X8QuaternionTest(void)
got = D3DXQuaternionDot(NULL,NULL);
ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
/*_______________D3DXQuaternionIdentity________________*/
expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 1.0f;
D3DXQuaternionIdentity(&gotquat);
expect_vec4(expectedquat,gotquat);
/* Test the NULL case */
funcpointer = D3DXQuaternionIdentity(NULL);
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXQuaternionLength__________________________*/
expected = 11.0f;
got = D3DXQuaternionLength(&q);

View File

@ -274,6 +274,16 @@ static inline FLOAT D3DXQuaternionDot(CONST D3DXQUATERNION *pq1, CONST D3DXQUATE
return (pq1->x) * (pq2->x) + (pq1->y) * (pq2->y) + (pq1->z) * (pq2->z) + (pq1->w) * (pq2->w);
}
static inline D3DXQUATERNION* D3DXQuaternionIdentity(D3DXQUATERNION *pout)
{
if ( !pout) return NULL;
pout->x = 0.0f;
pout->y = 0.0f;
pout->z = 0.0f;
pout->w = 1.0f;
return pout;
}
static inline FLOAT D3DXQuaternionLength(CONST D3DXQUATERNION *pq)
{
if (!pq) return 0.0f;