Module: wine Branch: master Commit: 10259cd87c51946d82abc41059c076b0fa213a57 URL: http://source.winehq.org/git/wine.git/?a=commit;h=10259cd87c51946d82abc41059...
Author: David Adam David.Adam@math.cnrs.fr Date: Tue Oct 23 10:58:41 2007 +0200
d3dx8: Implement D3DXPlaneDot.
---
dlls/d3dx8/tests/math.c | 22 ++++++++++++++++++++++ include/d3dx8math.inl | 8 ++++++++ 2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c index c5d731b..2d5bdbb 100644 --- a/dlls/d3dx8/tests/math.c +++ b/dlls/d3dx8/tests/math.c @@ -30,6 +30,27 @@
#define expect_vec4(expectedvec,gotvec) ok((fabs(expectedvec.x-gotvec.x)<admitted_error)&&(fabs(expectedvec.y-gotvec.y)<admitted_error)&&(fabs(expectedvec.z-gotvec.z)<admitted_error)&&(fabs(expectedvec.w-gotvec.w)<admitted_error),"Expected Vector= (%f, %f, %f, %f)\n , Got Vector= (%f, %f, %f, %f)\n", expectedvec.x, expectedvec.y, expectedvec.z, expectedvec.w, gotvec.x, gotvec.y, gotvec.z, gotvec.w);
+static void D3DXPlaneTest(void) +{ + D3DXPLANE plane; + D3DXVECTOR4 vec; + FLOAT expected, got; + + plane.a = -3.0f; plane.b = -1.0f; plane.c = 4.0f; plane.d = 7.0f; + vec.x = 2.0f; vec.y = 5.0f; vec.z = -6.0f; vec.w = 11.0f; + +/*_______________D3DXPlaneDot________________*/ + expected = 42.0f; + got = D3DXPlaneDot(&plane,&vec), + ok( expected == got, "Expected : %f, Got : %f\n",expected, got); + expected = 0.0f; + got = D3DXPlaneDot(NULL,&vec), + ok( expected == got, "Expected : %f, Got : %f\n",expected, got); + expected = 0.0f; + got = D3DXPlaneDot(NULL,NULL), + ok( expected == got, "Expected : %f, Got : %f\n",expected, got); +} + static void D3X8QuaternionTest(void) { D3DXQUATERNION expectedquat, gotquat, q, r, s; @@ -430,6 +451,7 @@ static void D3X8Vector4Test(void)
START_TEST(math) { + D3DXPlaneTest(); D3X8QuaternionTest(); D3X8Vector2Test(); D3X8Vector3Test(); diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl index 066dce2..78146ec 100644 --- a/include/d3dx8math.inl +++ b/include/d3dx8math.inl @@ -258,6 +258,14 @@ static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4
/*__________________D3DXQUATERNION____________________*/
+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) + (pp->d) * (pv->w) ); +} + +/*__________________D3DXQUATERNION____________________*/ + static inline D3DXQUATERNION* D3DXQuaternionConjugate(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq) { if ( !pout || !pq) return NULL;