[PATCH] Implement D3DXVec3Cross with a test
David Adam
David.Adam at math.cnrs.fr
Thu Oct 18 13:12:29 CDT 2007
---
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 ef796f9..92f0a82 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -203,6 +203,15 @@ static void D3X8Vector3Test(void)
funcpointer =3D D3DXVec3Add(NULL,NULL,NULL);
ok(funcpointer =3D=3D NULL, "Expected: %p, Got: %p\n", NULL, funcpointe=
r);
=20
+/*_______________D3DXVec3Cross________________________*/
+ expectedvec.x =3D -18.0f; expectedvec.y =3D 40.0f; expectedvec.z =3D -3=
0.0f;
+ D3DXVec3Cross(&gotvec,&u,&v);
+ /* Tests the case NULL */
+ funcpointer =3D D3DXVec3Cross(&gotvec,NULL,&v);
+ ok(funcpointer =3D=3D NULL, "Expected: %p, Got: %p\n", NULL, funcpointe=
r);
+ funcpointer =3D D3DXVec3Cross(NULL,NULL,NULL);
+ ok(funcpointer =3D=3D NULL, "Expected: %p, Got: %p\n", NULL, funcpointe=
r);
+
/*_______________D3DXVec3Dot__________________________*/
expected =3D -8.0f;
got =3D D3DXVec3Dot(&u,&v);
diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl
index 547dc7b..77c454c 100644
--- a/include/d3dx8math.inl
+++ b/include/d3dx8math.inl
@@ -104,6 +104,15 @@ static inline D3DXVECTOR3* D3DXVec3Add(D3DXVECTOR3 *pou=
t, CONST D3DXVECTOR3 *pv1
return pout;
}
=20
+static inline D3DXVECTOR3* D3DXVec3Cross(D3DXVECTOR3 *pout, CONST D3DXVECTO=
R3 *pv1, CONST D3DXVECTOR3 *pv2)
+{
+ if ( !pout || !pv1 || !pv2) return NULL;
+ pout->x =3D (pv1->y) * (pv2->z) - (pv1->z) * (pv2->y);
+ pout->y =3D (pv1->z) * (pv2->x) - (pv1->x) * (pv2->z);
+ pout->z =3D (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;
--=20
1.5.3.2
--=_30yrlgbi96uc--
More information about the wine-patches
mailing list