[PATCH] Implement D3DXPlaneNormal with a test

David Adam David.Adam at math.cnrs.fr
Tue Oct 23 04:06:33 CDT 2007


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

diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index c318a45..e73a619 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -60,6 +60,17 @@ static void D3DXPlaneTest(void)
     expected =3D 0.0f;
     got =3D D3DXPlaneDotCoord(NULL,NULL),
     ok( expected =3D=3D got, "Expected : %f, Got : %f\n",expected, got);
+
+/*_______________D3DXPlaneDotNormal______________*/
+    expected =3D -35.0f;
+    got =3D D3DXPlaneDotNormal(&plane,&vec),
+    ok( expected =3D=3D got, "Expected : %f, Got : %f\n",expected, got);
+    expected =3D 0.0f;
+    got =3D D3DXPlaneDotNormal(NULL,&vec),
+    ok( expected =3D=3D got, "Expected : %f, Got : %f\n",expected, got);
+    expected =3D 0.0f;
+    got =3D D3DXPlaneDotNormal(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 e8e6a02..71f9641 100644
--- a/include/d3dx8math.inl
+++ b/include/d3dx8math.inl
@@ -270,6 +270,12 @@ static inline FLOAT D3DXPlaneDotCoord(CONST D3DXPLANE *=
pp, CONST D3DXVECTOR4 *pv
     return ( (pp->a) * (pv->x) + (pp->b) * (pv->y) + (pp->c) * (pv->z) + (p=
p->d) );
 }
=20
+static inline FLOAT D3DXPlaneDotNormal(CONST D3DXPLANE *pp, CONST D3DXVECTO=
R4 *pv)
+{
+    if ( !pp || !pv ) return 0.0f;
+    return ( (pp->a) * (pv->x) + (pp->b) * (pv->y) + (pp->c) * (pv->z) );
+}
+
 /*__________________D3DXQUATERNION____________________*/
=20
 static inline D3DXQUATERNION* D3DXQuaternionConjugate(D3DXQUATERNION *pout,=
 CONST D3DXQUATERNION *pq)
--=20
1.5.3.2


--=_7k5se82120sg--



More information about the wine-patches mailing list