David Adam : d3dx8: Implement D3DXVec3Cross.

Alexandre Julliard julliard at winehq.org
Mon Oct 22 09:55:47 CDT 2007


Module: wine
Branch: master
Commit: a394fef4b75f6a1024644d1ac8d4302811e16722
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a394fef4b75f6a1024644d1ac8d4302811e16722

Author: David Adam <David.Adam at math.cnrs.fr>
Date:   Thu Oct 18 20:12:29 2007 +0200

d3dx8: Implement D3DXVec3Cross.

---

 dlls/d3dx8/tests/math.c |    9 +++++++++
 include/d3dx8math.inl   |    9 +++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index 9197ba1..b7302b1 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 b9cf875..87e1289 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;




More information about the wine-cvs mailing list