diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index 9197ba16320..b7302b17504 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -203,6 +203,15 @@ static void D3X8Vector3Test(void) funcpointer = D3DXVec3Add(NULL,NULL,NULL); 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__________________________*/ expected = -8.0f; got = D3DXVec3Dot(&u,&v); diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl index b9cf875fe0f..87e12899332 100644 --- a/include/d3dx8math.inl +++ b/include/d3dx8math.inl @@ -104,6 +104,15 @@ static inline D3DXVECTOR3* D3DXVec3Add(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1 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) { if ( !pv1 || !pv2 ) return 0.0f;