d3dx8: Implement D3DXQuaternionConjugate.

This commit is contained in:
David Adam 2007-10-18 20:28:36 +02:00 committed by Alexandre Julliard
parent a394fef4b7
commit 77f5d4c88c
2 changed files with 23 additions and 1 deletions

View File

@ -32,12 +32,24 @@
static void D3X8QuaternionTest(void)
{
D3DXQUATERNION q, r;
D3DXQUATERNION expectedquat, gotquat, q, r;
LPD3DXQUATERNION funcpointer;
FLOAT expected, got;
q.x = 1.0f, q.y = 2.0f; q.z = 4.0f; q.w = 10.0f;
r.x = -3.0f; r.y = 4.0f; r.z = -5.0f; r.w = 7.0;
/*_______________D3DXQuaternionConjugate________________*/
expectedquat.x = -1.0f; expectedquat.y = -2.0f; expectedquat.z = -4.0f; expectedquat.w = 10.0f;
D3DXQuaternionConjugate(&gotquat,&q);
expect_vec4(expectedquat,gotquat);
/* Test the NULL case */
funcpointer = D3DXQuaternionConjugate(&gotquat,NULL);
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
funcpointer = D3DXQuaternionConjugate(NULL,NULL);
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXQuaternionDot______________________*/
expected = 55.0f;
got = D3DXQuaternionDot(&q,&r);

View File

@ -258,6 +258,16 @@ static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4
/*__________________D3DXQUATERNION____________________*/
static inline D3DXQUATERNION* D3DXQuaternionConjugate(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq)
{
if ( !pout || !pq) return NULL;
pout->x = -pq->x;
pout->y = -pq->y;
pout->z = -pq->z;
pout->w = pq->w;
return pout;
}
static inline FLOAT D3DXQuaternionDot(CONST D3DXQUATERNION *pq1, CONST D3DXQUATERNION *pq2)
{
if ( !pq1 || !pq2 ) return 0.0f;