d3dx8: Implement D3DXVec3Cross.
This commit is contained in:
parent
9657611878
commit
a394fef4b7
|
@ -203,6 +203,15 @@ static void D3X8Vector3Test(void)
|
||||||
funcpointer = D3DXVec3Add(NULL,NULL,NULL);
|
funcpointer = D3DXVec3Add(NULL,NULL,NULL);
|
||||||
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
|
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
|
||||||
|
|
||||||
|
/*_______________D3DXVec3Cross________________________*/
|
||||||
|
expectedvec.x = -18.0f; expectedvec.y = 40.0f; expectedvec.z = -30.0f;
|
||||||
|
D3DXVec3Cross(&gotvec,&u,&v);
|
||||||
|
/* Tests the case NULL */
|
||||||
|
funcpointer = D3DXVec3Cross(&gotvec,NULL,&v);
|
||||||
|
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
|
||||||
|
funcpointer = D3DXVec3Cross(NULL,NULL,NULL);
|
||||||
|
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
|
||||||
|
|
||||||
/*_______________D3DXVec3Dot__________________________*/
|
/*_______________D3DXVec3Dot__________________________*/
|
||||||
expected = -8.0f;
|
expected = -8.0f;
|
||||||
got = D3DXVec3Dot(&u,&v);
|
got = D3DXVec3Dot(&u,&v);
|
||||||
|
|
|
@ -104,6 +104,15 @@ static inline D3DXVECTOR3* D3DXVec3Add(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1
|
||||||
return pout;
|
return pout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline D3DXVECTOR3* D3DXVec3Cross(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
|
||||||
|
{
|
||||||
|
if ( !pout || !pv1 || !pv2) return NULL;
|
||||||
|
pout->x = (pv1->y) * (pv2->z) - (pv1->z) * (pv2->y);
|
||||||
|
pout->y = (pv1->z) * (pv2->x) - (pv1->x) * (pv2->z);
|
||||||
|
pout->z = (pv1->x) * (pv2->y) - (pv1->y) * (pv2->x);
|
||||||
|
return pout;
|
||||||
|
}
|
||||||
|
|
||||||
static inline FLOAT D3DXVec3Dot(CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
|
static inline FLOAT D3DXVec3Dot(CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
|
||||||
{
|
{
|
||||||
if ( !pv1 || !pv2 ) return 0.0f;
|
if ( !pv1 || !pv2 ) return 0.0f;
|
||||||
|
|
Loading…
Reference in New Issue