David Adam : d3dx8: Implement D3DX*Maximize.

Alexandre Julliard julliard at winehq.org
Mon Oct 22 09:55:47 CDT 2007


Module: wine
Branch: master
Commit: c7f0eca4e3b9985fd66ac53c418861a621080688
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c7f0eca4e3b9985fd66ac53c418861a621080688

Author: David Adam <David.Adam at math.cnrs.fr>
Date:   Thu Oct 18 19:29:21 2007 +0200

d3dx8: Implement D3DX*Maximize.

---

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

diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index 7d1a84e..1490a66 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -243,6 +243,16 @@ static void D3X8Vector3Test(void)
     funcpointer = D3DXVec3Lerp(NULL,NULL,NULL,scale);
     ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
 
+/*_______________D3DXVec3Maximize__________________________*/
+    expectedvec.x = 9.0f; expectedvec.y = 6.0f; expectedvec.z = 2.0f;
+    D3DXVec3Maximize(&gotvec,&u,&v);
+    expect_vec3(expectedvec,gotvec);
+    /* Tests the case NULL */
+    funcpointer = D3DXVec3Maximize(&gotvec,NULL,&v);
+    ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
+    funcpointer = D3DXVec3Maximize(NULL,NULL,NULL);
+    ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
+
 /*_______________D3DXVec3Subtract_______________________*/
     expectedvec.x = 7.0f; expectedvec.y = 9.0f; expectedvec.z = 6.0f;
     D3DXVec3Subtract(&gotvec,&u,&v);
@@ -315,6 +325,16 @@ static void D3X8Vector4Test(void)
     funcpointer = D3DXVec4Lerp(NULL,NULL,NULL,scale);
     ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
 
+/*_______________D3DXVec4Maximize__________________________*/
+    expectedvec.x = 1.0f; expectedvec.y = 4.0f; expectedvec.z = 4.0f; expectedvec.w = 10.0;
+    D3DXVec4Maximize(&gotvec,&u,&v);
+    expect_vec4(expectedvec,gotvec);
+    /* Tests the case NULL */
+    funcpointer = D3DXVec4Maximize(&gotvec,NULL,&v);
+    ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
+    funcpointer = D3DXVec4Maximize(NULL,NULL,NULL);
+    ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
+
 /*_______________D3DXVec4Subtract__________________________*/
     expectedvec.x = 4.0f; expectedvec.y = -2.0f; expectedvec.z = 9.0f; expectedvec.w = 3.0f;
     D3DXVec4Subtract(&gotvec,&u,&v);
diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl
index ab1b9be..1da846d 100644
--- a/include/d3dx8math.inl
+++ b/include/d3dx8math.inl
@@ -131,6 +131,15 @@ static inline D3DXVECTOR3* D3DXVec3Lerp(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv
     return pout;
 }
 
+static inline D3DXVECTOR3* D3DXVec3Maximize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
+{
+    if ( !pout || !pv1 || !pv2) return NULL;
+    pout->x = max(pv1->x , pv2->x);
+    pout->y = max(pv1->y , pv2->y);
+    pout->z = max(pv1->z , pv2->z);
+    return pout;
+}
+
 static inline D3DXVECTOR3* D3DXVec3Subtract(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
 {
     if ( !pout || !pv1 || !pv2) return NULL;
@@ -179,6 +188,17 @@ static inline D3DXVECTOR4* D3DXVec4Lerp(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv
     return pout;
 }
 
+
+static inline D3DXVECTOR4* D3DXVec4Maximize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2)
+{
+    if ( !pout || !pv1 || !pv2) return NULL;
+    pout->x = max(pv1->x , pv2->x);
+    pout->y = max(pv1->y , pv2->y);
+    pout->z = max(pv1->z , pv2->z);
+    pout->w = max(pv1->w , pv2->w);
+    return pout;
+}
+
 static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2)
 {
     if ( !pout || !pv1 || !pv2) return NULL;




More information about the wine-cvs mailing list