[PATCH] Implement D3DX__Minimize with a test
David Adam
David.Adam at math.cnrs.fr
Thu Oct 18 12:35:52 CDT 2007
---
dlls/d3dx8/tests/math.c | 20 ++++++++++++++++++++
include/d3dx8math.inl | 19 +++++++++++++++++++
2 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index 550d1b4..00328f2 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -253,6 +253,16 @@ static void D3X8Vector3Test(void)
funcpointer =3D D3DXVec3Maximize(NULL,NULL,NULL);
ok(funcpointer =3D=3D NULL, "Expected: %p, Got: %p\n", NULL, funcpointe=
r);
=20
+/*_______________D3DXVec3Minimize__________________________*/
+ expectedvec.x =3D 2.0f; expectedvec.y =3D -3.0f; expectedvec.z =3D -4.0=
f;
+ D3DXVec3Minimize(&gotvec,&u,&v);
+ expect_vec3(expectedvec,gotvec);
+ /* Tests the case NULL */
+ funcpointer =3D D3DXVec3Minimize(&gotvec,NULL,&v);
+ ok(funcpointer =3D=3D NULL, "Expected: %p, Got: %p\n", NULL, funcpointe=
r);
+ funcpointer =3D D3DXVec3Minimize(NULL,NULL,NULL);
+ ok(funcpointer =3D=3D NULL, "Expected: %p, Got: %p\n", NULL, funcpointe=
r);
+
/*_______________D3DXVec3Subtract_______________________*/
expectedvec.x =3D 7.0f; expectedvec.y =3D 9.0f; expectedvec.z =3D 6.0f;=
=20
D3DXVec3Subtract(&gotvec,&u,&v);
@@ -335,6 +345,16 @@ static void D3X8Vector4Test(void)
funcpointer =3D D3DXVec4Maximize(NULL,NULL,NULL);
ok(funcpointer =3D=3D NULL, "Expected: %p, Got: %p\n", NULL, funcpointe=
r);
=20
+/*_______________D3DXVec4Minimize__________________________*/
+ expectedvec.x =3D -3.0f; expectedvec.y =3D 2.0f; expectedvec.z =3D -5.0=
f; expectedvec.w =3D 7.0;
+ D3DXVec4Minimize(&gotvec,&u,&v);
+ expect_vec4(expectedvec,gotvec);
+ /* Tests the case NULL */
+ funcpointer =3D D3DXVec4Minimize(&gotvec,NULL,&v);
+ ok(funcpointer =3D=3D NULL, "Expected: %p, Got: %p\n", NULL, funcpointe=
r);
+ funcpointer =3D D3DXVec4Minimize(NULL,NULL,NULL);
+ ok(funcpointer =3D=3D NULL, "Expected: %p, Got: %p\n", NULL, funcpointe=
r);
+
/*_______________D3DXVec4Subtract__________________________*/
expectedvec.x =3D 4.0f; expectedvec.y =3D -2.0f; expectedvec.z =3D 9.0f=
; expectedvec.w =3D 3.0f;
D3DXVec4Subtract(&gotvec,&u,&v);
diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl
index d043cba..756d911 100644
--- a/include/d3dx8math.inl
+++ b/include/d3dx8math.inl
@@ -140,6 +140,15 @@ static inline D3DXVECTOR3* D3DXVec3Maximize(D3DXVECTOR3=
*pout, CONST D3DXVECTOR3
return pout;
}
=20
+static inline D3DXVECTOR3* D3DXVec3Minimize(D3DXVECTOR3 *pout, CONST D3DXVE=
CTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
+{
+ if ( !pout || !pv1 || !pv2) return NULL;
+ pout->x =3D min(pv1->x , pv2->x);
+ pout->y =3D min(pv1->y , pv2->y);
+ pout->z =3D min(pv1->z , pv2->z);=20
+ return pout;
+}
+
static inline D3DXVECTOR3* D3DXVec3Subtract(D3DXVECTOR3 *pout, CONST D3DXVE=
CTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
@@ -199,6 +208,16 @@ static inline D3DXVECTOR4* D3DXVec4Maximize(D3DXVECTOR4=
*pout, CONST D3DXVECTOR4
return pout;
}
=20
+static inline D3DXVECTOR4* D3DXVec4Minimize(D3DXVECTOR4 *pout, CONST D3DXVE=
CTOR4 *pv1, CONST D3DXVECTOR4 *pv2)
+{
+ if ( !pout || !pv1 || !pv2) return NULL;
+ pout->x =3D min(pv1->x , pv2->x);
+ pout->y =3D min(pv1->y , pv2->y);
+ pout->z =3D min(pv1->z , pv2->z);=20
+ pout->w =3D min(pv1->w , pv2->w);
+ return pout;
+}
+
static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVE=
CTOR4 *pv1, CONST D3DXVECTOR4 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
--=20
1.5.3.2
--=_33r52f9oz3eo--
More information about the wine-patches
mailing list