[PATCH] Implement D3DXPlaneDotCoord with a test

David Adam David.Adam at math.cnrs.fr
Tue Oct 23 04:01:43 CDT 2007


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

diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index 2d5bdbb..c318a45 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -49,6 +49,17 @@ static void D3DXPlaneTest(void)
     expected =3D 0.0f;
     got =3D D3DXPlaneDot(NULL,NULL),
     ok( expected =3D=3D got, "Expected : %f, Got : %f\n",expected, got);
+
+/*_______________D3DXPlaneDotCoord________________*/
+    expected =3D -28.0f;
+    got =3D D3DXPlaneDotCoord(&plane,&vec),
+    ok( expected =3D=3D got, "Expected : %f, Got : %f\n",expected, got);
+    expected =3D 0.0f;
+    got =3D D3DXPlaneDotCoord(NULL,&vec),
+    ok( expected =3D=3D got, "Expected : %f, Got : %f\n",expected, got);
+    expected =3D 0.0f;
+    got =3D D3DXPlaneDotCoord(NULL,NULL),
+    ok( expected =3D=3D got, "Expected : %f, Got : %f\n",expected, got);
 }
=20
 static void D3X8QuaternionTest(void)
diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl
index 78146ec..e8e6a02 100644
--- a/include/d3dx8math.inl
+++ b/include/d3dx8math.inl
@@ -258,12 +258,18 @@ static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR=
4 *pout, CONST D3DXVECTOR4
=20
 /*__________________D3DXQUATERNION____________________*/
=20
-static inline FLOAT D3DXPlaneDot( CONST D3DXPLANE *pp, CONST D3DXVECTOR4 *p=
v)
+static inline FLOAT D3DXPlaneDot(CONST D3DXPLANE *pp, CONST D3DXVECTOR4 *pv=
)
 {
     if ( !pp || !pv ) return 0.0f;
     return ( (pp->a) * (pv->x) + (pp->b) * (pv->y) + (pp->c) * (pv->z) + (p=
p->d) * (pv->w) );
 }
=20
+static inline FLOAT D3DXPlaneDotCoord(CONST D3DXPLANE *pp, CONST D3DXVECTOR=
4 *pv)
+{
+    if ( !pp || !pv ) return 0.0f;
+    return ( (pp->a) * (pv->x) + (pp->b) * (pv->y) + (pp->c) * (pv->z) + (p=
p->d) );
+}
+
 /*__________________D3DXQUATERNION____________________*/
=20
 static inline D3DXQUATERNION* D3DXQuaternionConjugate(D3DXQUATERNION *pout,=
 CONST D3DXQUATERNION *pq)
--=20
1.5.3.2


--=_4skimlb0uw00--



More information about the wine-patches mailing list