Commit 10259cd8 authored by David Adam's avatar David Adam Committed by Alexandre Julliard

d3dx8: Implement D3DXPlaneDot.

parent 74c5d175
......@@ -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();
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment