d3dx8 math implementation + tests: use more "," instead of ";".
Lionel Debroux
lionel_debroux at yahoo.fr
Fri Oct 26 04:16:08 CDT 2007
---
dlls/d3dx8/tests/math.c | 104 +++++++++++++++---------------
include/d3dx8math.inl | 158 ++++++++++++++++++++++++-----------------------
2 files changed, 132 insertions(+), 130 deletions(-)
diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index 0e70183..68b41a8 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -38,13 +38,13 @@ static void D3DXColorTest(void)
LPD3DXCOLOR funcpointer;
FLOAT scale;
- color.r = 0.2f; color.g = 0.75f; color.b = 0.41f; color.a = 0.93f;
- color1.r = 0.6f; color1.g = 0.55f; color1.b = 0.23f; color1.a = 0.82f;
- color2.r = 0.3f; color2.g = 0.5f; color2.b = 0.76f; color2.a = 0.11f;
+ color.r = 0.2f, color.g = 0.75f, color.b = 0.41f, color.a = 0.93f,
+ color1.r = 0.6f, color1.g = 0.55f, color1.b = 0.23f, color1.a = 0.82f,
+ color2.r = 0.3f, color2.g = 0.5f, color2.b = 0.76f, color2.a = 0.11f,
scale = 0.3f;
/*_______________D3DXColorAdd________________*/
- expected.r = 0.9f; expected.g = 1.05f; expected.b = 0.99f, expected.a = 0.93f;
+ expected.r = 0.9f, expected.g = 1.05f, expected.b = 0.99f, expected.a = 0.93f;
D3DXColorAdd(&got,&color1,&color2);
expect_color(expected,got);
/* Test the NULL case */
@@ -56,7 +56,7 @@ static void D3DXColorTest(void)
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXColorLerp________________*/
- expected.r = 0.32f; expected.g = 0.69f; expected.b = 0.356f; expected.a = 0.897f;
+ expected.r = 0.32f, expected.g = 0.69f, expected.b = 0.356f, expected.a = 0.897f;
D3DXColorLerp(&got,&color,&color1,scale);
expect_color(expected,got);
/* Test the NULL case */
@@ -68,7 +68,7 @@ static void D3DXColorTest(void)
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXColorModulate________________*/
- expected.r = 0.18f; expected.g = 0.275f; expected.b = 0.1748f; expected.a = 0.0902f;
+ expected.r = 0.18f, expected.g = 0.275f, expected.b = 0.1748f, expected.a = 0.0902f;
D3DXColorModulate(&got,&color1,&color2);
expect_color(expected,got);
/* Test the NULL case */
@@ -80,17 +80,17 @@ static void D3DXColorTest(void)
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXColorNegative________________*/
- expected.r = 0.8f; expected.g = 0.25f; expected.b = 0.59f; expected.a = 0.93f;
+ expected.r = 0.8f, expected.g = 0.25f, expected.b = 0.59f, expected.a = 0.93f;
D3DXColorNegative(&got,&color);
expect_color(got,expected);
/* Test the greater than 1 case */
- color1.r = 0.2f; color1.g = 1.75f; color1.b = 0.41f; color1.a = 0.93f;
- expected.r = 0.8f; expected.g = -0.75f; expected.b = 0.59f; expected.a = 0.93f;
+ color1.r = 0.2f, color1.g = 1.75f, color1.b = 0.41f, color1.a = 0.93f,
+ expected.r = 0.8f, expected.g = -0.75f, expected.b = 0.59f, expected.a = 0.93f;
D3DXColorNegative(&got,&color1);
expect_color(got,expected);
/* Test the negative case */
- color1.r = 0.2f; color1.g = -0.75f; color1.b = 0.41f; color1.a = 0.93f;
- expected.r = 0.8f; expected.g = 1.75f; expected.b = 0.59f; expected.a = 0.93f;
+ color1.r = 0.2f, color1.g = -0.75f, color1.b = 0.41f, color1.a = 0.93f,
+ expected.r = 0.8f, expected.g = 1.75f, expected.b = 0.59f, expected.a = 0.93f;
D3DXColorNegative(&got,&color1);
expect_color(got,expected);
/* Test the NULL case */
@@ -100,7 +100,7 @@ static void D3DXColorTest(void)
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXColorScale________________*/
- expected.r = 0.06f; expected.g = 0.225f; expected.b = 0.123f; expected.a = 0.279f;
+ expected.r = 0.06f, expected.g = 0.225f, expected.b = 0.123f, expected.a = 0.279f;
D3DXColorScale(&got,&color,scale);
expect_color(expected,got);
/* Test the NULL case */
@@ -110,7 +110,7 @@ static void D3DXColorTest(void)
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXColorSubtract_______________*/
- expected.r = -0.1f; expected.g = 0.25f; expected.b = -0.35f, expected.a = 0.82f;
+ expected.r = -0.1f, expected.g = 0.25f, expected.b = -0.35f, expected.a = 0.82f;
D3DXColorSubtract(&got,&color,&color2);
expect_color(expected,got);
/* Test the NULL case */
@@ -128,11 +128,11 @@ static void D3DXMatrixTest(void)
BOOL expected, got;
/*____________D3DXMatrixIsIdentity______________*/
- mat.m[0][1] = 0.0f; mat.m[0][2] = 7.0f; mat.m[0][3] = 8.0f;
- mat.m[1][0] = 11.0f; mat.m[1][2] = 0.0f; mat.m[1][3] = 0.0f;
- mat.m[2][0] = 0.0f; mat.m[2][1] = 0.0f; mat.m[2][3] = 0.0f;
- mat.m[3][0] = 0.0f; mat.m[3][1] = 0.0f; mat.m[3][2] = 0.0f;
- mat.m[0][0] = 1.0f; mat.m[1][1] = 1.0f; mat.m[2][2] = 1.0f;
+ mat.m[0][1] = 0.0f, mat.m[0][2] = 7.0f, mat.m[0][3] = 8.0f,
+ mat.m[1][0] = 11.0f, mat.m[1][2] = 0.0f, mat.m[1][3] = 0.0f,
+ mat.m[2][0] = 0.0f, mat.m[2][1] = 0.0f, mat.m[2][3] = 0.0f,
+ mat.m[3][0] = 0.0f, mat.m[3][1] = 0.0f, mat.m[3][2] = 0.0f,
+ mat.m[0][0] = 1.0f, mat.m[1][1] = 1.0f, mat.m[2][2] = 1.0f,
mat.m[3][3] = 1.0f;
expected = FALSE;
got = D3DXMatrixIsIdentity(&mat);
@@ -155,8 +155,8 @@ static void D3DXPlaneTest(void)
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;
+ 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;
@@ -199,11 +199,11 @@ static void D3X8QuaternionTest(void)
FLOAT expected, got;
BOOL expectedbool, gotbool;
- q.x = 1.0f, q.y = 2.0f; q.z = 4.0f; q.w = 10.0f;
- r.x = -3.0f; r.y = 4.0f; r.z = -5.0f; r.w = 7.0;
+ q.x = 1.0f, q.y = 2.0f, q.z = 4.0f, q.w = 10.0f,
+ r.x = -3.0f, r.y = 4.0f, r.z = -5.0f, r.w = 7.0;
/*_______________D3DXQuaternionConjugate________________*/
- expectedquat.x = -1.0f; expectedquat.y = -2.0f; expectedquat.z = -4.0f; expectedquat.w = 10.0f;
+ expectedquat.x = -1.0f, expectedquat.y = -2.0f, expectedquat.z = -4.0f, expectedquat.w = 10.0f;
D3DXQuaternionConjugate(&gotquat,&q);
expect_vec4(expectedquat,gotquat);
/* Test the NULL case */
@@ -225,7 +225,7 @@ static void D3X8QuaternionTest(void)
ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
/*_______________D3DXQuaternionIdentity________________*/
- expectedquat.x = 0.0f; expectedquat.y = 0.0f; expectedquat.z = 0.0f; expectedquat.w = 1.0f;
+ expectedquat.x = 0.0f, expectedquat.y = 0.0f, expectedquat.z = 0.0f, expectedquat.w = 1.0f;
D3DXQuaternionIdentity(&gotquat);
expect_vec4(expectedquat,gotquat);
/* Test the NULL case */
@@ -233,11 +233,11 @@ static void D3X8QuaternionTest(void)
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXQuaternionIsIdentity________________*/
- s.x = 0.0f; s.y = 0.0f; s.z = 0.0f; s.w = 1.0f;
+ s.x = 0.0f, s.y = 0.0f, s.z = 0.0f, s.w = 1.0f;
expectedbool = TRUE;
gotbool = D3DXQuaternionIsIdentity(&s);
ok( expectedbool == gotbool, "Expected boolean : %d, Got bool : %d\n", expectedbool, gotbool);
- s.x = 2.3f; s.y = -4.2f; s.z = 1.2f; s.w=0.2f;
+ s.x = 2.3f, s.y = -4.2f, s.z = 1.2f, s.w=0.2f;
expectedbool = FALSE;
gotbool = D3DXQuaternionIsIdentity(&q);
ok( expectedbool == gotbool, "Expected boolean : %d, Got bool : %d\n", expectedbool, gotbool);
@@ -270,12 +270,12 @@ static void D3X8Vector2Test(void)
LPD3DXVECTOR2 funcpointer;
FLOAT expected, got, scale;
- u.x=3.0f; u.y=4.0f;
- v.x=-7.0f; v.y=9.0f;
+ u.x=3.0f, u.y=4.0f,
+ v.x=-7.0f, v.y=9.0f,
scale = -6.5f;
/*_______________D3DXVec2Add__________________________*/
- expectedvec.x = -4.0f; expectedvec.y = 13.0f;
+ expectedvec.x = -4.0f, expectedvec.y = 13.0f;
D3DXVec2Add(&gotvec,&u,&v);
expect_vec(expectedvec,gotvec);
/* Tests the case NULL */
@@ -327,7 +327,7 @@ static void D3X8Vector2Test(void)
ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
/*_______________D3DXVec2Lerp__________________________*/
- expectedvec.x = 68.0f; expectedvec.y = -28.5f;
+ expectedvec.x = 68.0f, expectedvec.y = -28.5f;
D3DXVec2Lerp(&gotvec,&u,&v,scale);
expect_vec(expectedvec,gotvec);
/* Tests the case NULL */
@@ -337,7 +337,7 @@ static void D3X8Vector2Test(void)
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXVec2Maximize__________________________*/
- expectedvec.x = 3.0f; expectedvec.y = 9.0f;
+ expectedvec.x = 3.0f, expectedvec.y = 9.0f;
D3DXVec2Maximize(&gotvec,&u,&v);
expect_vec(expectedvec,gotvec);
/* Tests the case NULL */
@@ -347,7 +347,7 @@ static void D3X8Vector2Test(void)
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXVec2Minimize__________________________*/
- expectedvec.x = -7.0f; expectedvec.y = 4.0f;
+ expectedvec.x = -7.0f, expectedvec.y = 4.0f;
D3DXVec2Minimize(&gotvec,&u,&v);
expect_vec(expectedvec,gotvec);
/* Tests the case NULL */
@@ -357,7 +357,7 @@ static void D3X8Vector2Test(void)
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXVec2Scale____________________________*/
- expectedvec.x = -19.5f; expectedvec.y = -26.0f;
+ expectedvec.x = -19.5f, expectedvec.y = -26.0f;
D3DXVec2Scale(&gotvec,&u,scale);
expect_vec(expectedvec,gotvec);
/* Tests the case NULL */
@@ -367,7 +367,7 @@ static void D3X8Vector2Test(void)
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXVec2Subtract__________________________*/
- expectedvec.x = 10.0f; expectedvec.y = -5.0f;
+ expectedvec.x = 10.0f, expectedvec.y = -5.0f;
D3DXVec2Subtract(&gotvec,&u,&v);
expect_vec(expectedvec,gotvec);
/* Tests the case NULL */
@@ -384,12 +384,12 @@ static void D3X8Vector3Test(void)
LPD3DXVECTOR3 funcpointer;
FLOAT expected, got, scale;
- u.x = 9.0f; u.y = 6.0f; u.z = 2.0f;
- v.x = 2.0f; v.y = -3.0f; v.z = -4.0;
+ u.x = 9.0f, u.y = 6.0f, u.z = 2.0f,
+ v.x = 2.0f, v.y = -3.0f, v.z = -4.0,
scale = -6.5f;
/*_______________D3DXVec3Add__________________________*/
- expectedvec.x = 11.0f; expectedvec.y = 3.0f; expectedvec.z = -2.0f;
+ expectedvec.x = 11.0f, expectedvec.y = 3.0f, expectedvec.z = -2.0f;
D3DXVec3Add(&gotvec,&u,&v);
expect_vec3(expectedvec,gotvec);
/* Tests the case NULL */
@@ -399,7 +399,7 @@ static void D3X8Vector3Test(void)
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXVec3Cross________________________*/
- expectedvec.x = -18.0f; expectedvec.y = 40.0f; expectedvec.z = -30.0f;
+ expectedvec.x = -18.0f, expectedvec.y = 40.0f, expectedvec.z = -30.0f;
D3DXVec3Cross(&gotvec,&u,&v);
/* Tests the case NULL */
funcpointer = D3DXVec3Cross(&gotvec,NULL,&v);
@@ -438,7 +438,7 @@ static void D3X8Vector3Test(void)
ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
/*_______________D3DXVec3Lerp__________________________*/
- expectedvec.x = 54.5f; expectedvec.y = 64.5f, expectedvec.z = 41.0f ;
+ expectedvec.x = 54.5f, expectedvec.y = 64.5f, expectedvec.z = 41.0f ;
D3DXVec3Lerp(&gotvec,&u,&v,scale);
expect_vec3(expectedvec,gotvec);
/* Tests the case NULL */
@@ -448,7 +448,7 @@ static void D3X8Vector3Test(void)
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXVec3Maximize__________________________*/
- expectedvec.x = 9.0f; expectedvec.y = 6.0f; expectedvec.z = 2.0f;
+ expectedvec.x = 9.0f, expectedvec.y = 6.0f, expectedvec.z = 2.0f;
D3DXVec3Maximize(&gotvec,&u,&v);
expect_vec3(expectedvec,gotvec);
/* Tests the case NULL */
@@ -458,7 +458,7 @@ static void D3X8Vector3Test(void)
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXVec3Minimize__________________________*/
- expectedvec.x = 2.0f; expectedvec.y = -3.0f; expectedvec.z = -4.0f;
+ expectedvec.x = 2.0f, expectedvec.y = -3.0f, expectedvec.z = -4.0f;
D3DXVec3Minimize(&gotvec,&u,&v);
expect_vec3(expectedvec,gotvec);
/* Tests the case NULL */
@@ -468,7 +468,7 @@ static void D3X8Vector3Test(void)
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXVec3Scale____________________________*/
- expectedvec.x = -58.5f; expectedvec.y = -39.0f; expectedvec.z = -13.0f;
+ expectedvec.x = -58.5f, expectedvec.y = -39.0f, expectedvec.z = -13.0f;
D3DXVec3Scale(&gotvec,&u,scale);
expect_vec3(expectedvec,gotvec);
/* Tests the case NULL */
@@ -478,7 +478,7 @@ static void D3X8Vector3Test(void)
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXVec3Subtract_______________________*/
- expectedvec.x = 7.0f; expectedvec.y = 9.0f; expectedvec.z = 6.0f;
+ expectedvec.x = 7.0f, expectedvec.y = 9.0f, expectedvec.z = 6.0f;
D3DXVec3Subtract(&gotvec,&u,&v);
expect_vec3(expectedvec,gotvec);
/* Tests the case NULL */
@@ -494,13 +494,13 @@ static void D3X8Vector4Test(void)
D3DXVECTOR4 expectedvec, gotvec, u, v;
LPD3DXVECTOR4 funcpointer;
FLOAT expected, got, scale;
- scale = -6.5f;
+ scale = -6.5f,
- u.x = 1.0f; u.y = 2.0f; u.z = 4.0f; u.w = 10.0;
- v.x = -3.0f; v.y = 4.0f; v.z = -5.0f; v.w = 7.0;
+ u.x = 1.0f, u.y = 2.0f, u.z = 4.0f, u.w = 10.0,
+ v.x = -3.0f, v.y = 4.0f, v.z = -5.0f, v.w = 7.0;
/*_______________D3DXVec4Add__________________________*/
- expectedvec.x = -2.0f; expectedvec.y = 6.0f; expectedvec.z = -1.0f; expectedvec.w = 17.0f;
+ expectedvec.x = -2.0f, expectedvec.y = 6.0f, expectedvec.z = -1.0f, expectedvec.w = 17.0f;
D3DXVec4Add(&gotvec,&u,&v);
expect_vec4(expectedvec,gotvec);
/* Tests the case NULL */
@@ -540,7 +540,7 @@ static void D3X8Vector4Test(void)
ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
/*_______________D3DXVec4Lerp__________________________*/
- expectedvec.x = 27.0f; expectedvec.y = -11.0f; expectedvec.z = 62.5; expectedvec.w = 29.5;
+ expectedvec.x = 27.0f, expectedvec.y = -11.0f, expectedvec.z = 62.5, expectedvec.w = 29.5;
D3DXVec4Lerp(&gotvec,&u,&v,scale);
expect_vec4(expectedvec,gotvec);
/* Tests the case NULL */
@@ -550,7 +550,7 @@ static void D3X8Vector4Test(void)
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;
+ 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 */
@@ -560,7 +560,7 @@ static void D3X8Vector4Test(void)
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXVec4Minimize__________________________*/
- expectedvec.x = -3.0f; expectedvec.y = 2.0f; expectedvec.z = -5.0f; expectedvec.w = 7.0;
+ expectedvec.x = -3.0f, expectedvec.y = 2.0f, expectedvec.z = -5.0f, expectedvec.w = 7.0;
D3DXVec4Minimize(&gotvec,&u,&v);
expect_vec4(expectedvec,gotvec);
/* Tests the case NULL */
@@ -570,7 +570,7 @@ static void D3X8Vector4Test(void)
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
/*_______________D3DXVec4Scale____________________________*/
- expectedvec.x = -6.5f; expectedvec.y = -13.0f; expectedvec.z = -26.0f; expectedvec.w = -65.0f;
+ expectedvec.x = -6.5f, expectedvec.y = -13.0f, expectedvec.z = -26.0f, expectedvec.w = -65.0f;
D3DXVec4Scale(&gotvec,&u,scale);
expect_vec4(expectedvec,gotvec);
/* Tests the case NULL */
@@ -580,7 +580,7 @@ static void D3X8Vector4Test(void)
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;
+ expectedvec.x = 4.0f, expectedvec.y = -2.0f, expectedvec.z = 9.0f, expectedvec.w = 3.0f;
D3DXVec4Subtract(&gotvec,&u,&v);
expect_vec4(expectedvec,gotvec);
/* Tests the case NULL */
diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl
index 4df1f9e..6cee550 100644
--- a/include/d3dx8math.inl
+++ b/include/d3dx8math.inl
@@ -24,9 +24,9 @@
static inline D3DXCOLOR* D3DXColorAdd(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1, CONST D3DXCOLOR *pc2)
{
if ( !pout || !pc1 || !pc2 ) return NULL;
- pout->r = (pc1->r) + (pc2->r);
- pout->g = (pc1->g) + (pc2->g);
- pout->b = (pc1->b) + (pc2->b);
+ pout->r = (pc1->r) + (pc2->r),
+ pout->g = (pc1->g) + (pc2->g),
+ pout->b = (pc1->b) + (pc2->b),
pout->a = (pc1->a) + (pc2->a);
return pout;
}
@@ -34,9 +34,9 @@ static inline D3DXCOLOR* D3DXColorAdd(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1, CON
static inline D3DXCOLOR* D3DXColorLerp(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1, CONST D3DXCOLOR *pc2, FLOAT s)
{
if ( !pout || !pc1 || !pc2 ) return NULL;
- pout->r = (1-s) * (pc1->r) + s *(pc2->r);
- pout->g = (1-s) * (pc1->g) + s *(pc2->g);
- pout->b = (1-s) * (pc1->b) + s *(pc2->b);
+ pout->r = (1-s) * (pc1->r) + s *(pc2->r),
+ pout->g = (1-s) * (pc1->g) + s *(pc2->g),
+ pout->b = (1-s) * (pc1->b) + s *(pc2->b),
pout->a = (1-s) * (pc1->a) + s *(pc2->a);
return pout;
}
@@ -44,9 +44,9 @@ static inline D3DXCOLOR* D3DXColorLerp(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1, CO
static inline D3DXCOLOR* D3DXColorModulate(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1, CONST D3DXCOLOR *pc2)
{
if ( !pout || !pc1 || !pc2 ) return NULL;
- pout->r = (pc1->r) * (pc2->r);
- pout->g = (pc1->g) * (pc2->g);
- pout->b = (pc1->b) * (pc2->b);
+ pout->r = (pc1->r) * (pc2->r),
+ pout->g = (pc1->g) * (pc2->g),
+ pout->b = (pc1->b) * (pc2->b),
pout->a = (pc1->a) * (pc2->a);
return pout;
}
@@ -54,9 +54,9 @@ static inline D3DXCOLOR* D3DXColorModulate(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1
static inline D3DXCOLOR* D3DXColorNegative(D3DXCOLOR *pout, CONST D3DXCOLOR *pc)
{
if ( !pout || !pc ) return NULL;
- pout->r = 1.0f - pc->r;
- pout->g = 1.0f - pc->g;
- pout->b = 1.0f - pc->b;
+ pout->r = 1.0f - pc->r,
+ pout->g = 1.0f - pc->g,
+ pout->b = 1.0f - pc->b,
pout->a = pc->a;
return pout;
}
@@ -64,9 +64,9 @@ static inline D3DXCOLOR* D3DXColorNegative(D3DXCOLOR *pout, CONST D3DXCOLOR *pc)
static inline D3DXCOLOR* D3DXColorScale(D3DXCOLOR *pout, CONST D3DXCOLOR *pc, FLOAT s)
{
if ( !pout || !pc ) return NULL;
- pout->r = s* (pc->r);
- pout->g = s* (pc->g);
- pout->b = s* (pc->b);
+ pout->r = s* (pc->r),
+ pout->g = s* (pc->g),
+ pout->b = s* (pc->b),
pout->a = s* (pc->a);
return pout;
}
@@ -74,9 +74,9 @@ static inline D3DXCOLOR* D3DXColorScale(D3DXCOLOR *pout, CONST D3DXCOLOR *pc, FL
static inline D3DXCOLOR* D3DXColorSubtract(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1, CONST D3DXCOLOR *pc2)
{
if ( !pout || !pc1 || !pc2 ) return NULL;
- pout->r = (pc1->r) - (pc2->r);
- pout->g = (pc1->g) - (pc2->g);
- pout->b = (pc1->b) - (pc2->b);
+ pout->r = (pc1->r) - (pc2->r),
+ pout->g = (pc1->g) - (pc2->g),
+ pout->b = (pc1->b) - (pc2->b),
pout->a = (pc1->a) - (pc2->a);
return pout;
}
@@ -86,7 +86,7 @@ static inline D3DXCOLOR* D3DXColorSubtract(D3DXCOLOR *pout, CONST D3DXCOLOR *pc1
static inline D3DXVECTOR2* D3DXVec2Add(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
- pout->x = pv1->x + pv2->x;
+ pout->x = pv1->x + pv2->x,
pout->y = pv1->y + pv2->y;
return pout;
}
@@ -118,7 +118,7 @@ static inline FLOAT D3DXVec2LengthSq(CONST D3DXVECTOR2 *pv)
static inline D3DXVECTOR2* D3DXVec2Lerp(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2, FLOAT s)
{
if ( !pout || !pv1 || !pv2) return NULL;
- pout->x = (1-s) * (pv1->x) + s * (pv2->x);
+ pout->x = (1-s) * (pv1->x) + s * (pv2->x),
pout->y = (1-s) * (pv1->y) + s * (pv2->y);
return pout;
}
@@ -126,7 +126,7 @@ static inline D3DXVECTOR2* D3DXVec2Lerp(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv
static inline D3DXVECTOR2* D3DXVec2Maximize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
- pout->x = max(pv1->x , pv2->x);
+ pout->x = max(pv1->x , pv2->x),
pout->y = max(pv1->y , pv2->y);
return pout;
}
@@ -134,7 +134,7 @@ static inline D3DXVECTOR2* D3DXVec2Maximize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2
static inline D3DXVECTOR2* D3DXVec2Minimize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
- pout->x = min(pv1->x , pv2->x);
+ pout->x = min(pv1->x , pv2->x),
pout->y = min(pv1->y , pv2->y);
return pout;
}
@@ -142,7 +142,7 @@ static inline D3DXVECTOR2* D3DXVec2Minimize(D3DXVECTOR2 *pout, CONST D3DXVECTOR2
static inline D3DXVECTOR2* D3DXVec2Scale(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv, FLOAT s)
{
if ( !pout || !pv) return NULL;
- pout->x = s * (pv->x);
+ pout->x = s * (pv->x),
pout->y = s * (pv->y);
return pout;
}
@@ -150,7 +150,7 @@ static inline D3DXVECTOR2* D3DXVec2Scale(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *p
static inline D3DXVECTOR2* D3DXVec2Subtract(D3DXVECTOR2 *pout, CONST D3DXVECTOR2 *pv1, CONST D3DXVECTOR2 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
- pout->x = pv1->x - pv2->x;
+ pout->x = pv1->x - pv2->x,
pout->y = pv1->y - pv2->y;
return pout;
}
@@ -160,8 +160,8 @@ static inline D3DXVECTOR2* D3DXVec2Subtract(D3DXVECTOR2 *pout, CONST D3DXVECTOR2
static inline D3DXVECTOR3* D3DXVec3Add(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
- pout->x = pv1->x + pv2->x;
- pout->y = pv1->y + pv2->y;
+ pout->x = pv1->x + pv2->x,
+ pout->y = pv1->y + pv2->y,
pout->z = pv1->z + pv2->z;
return pout;
}
@@ -169,8 +169,8 @@ static inline D3DXVECTOR3* D3DXVec3Add(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1
static inline D3DXVECTOR3* D3DXVec3Cross(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
- pout->x = (pv1->y) * (pv2->z) - (pv1->z) * (pv2->y);
- pout->y = (pv1->z) * (pv2->x) - (pv1->x) * (pv2->z);
+ pout->x = (pv1->y) * (pv2->z) - (pv1->z) * (pv2->y),
+ pout->y = (pv1->z) * (pv2->x) - (pv1->x) * (pv2->z),
pout->z = (pv1->x) * (pv2->y) - (pv1->y) * (pv2->x);
return pout;
}
@@ -196,8 +196,8 @@ static inline FLOAT D3DXVec3LengthSq(CONST D3DXVECTOR3 *pv)
static inline D3DXVECTOR3* D3DXVec3Lerp(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2, FLOAT s)
{
if ( !pout || !pv1 || !pv2) return NULL;
- pout->x = (1-s) * (pv1->x) + s * (pv2->x);
- pout->y = (1-s) * (pv1->y) + s * (pv2->y);
+ pout->x = (1-s) * (pv1->x) + s * (pv2->x),
+ pout->y = (1-s) * (pv1->y) + s * (pv2->y),
pout->z = (1-s) * (pv1->z) + s * (pv2->z);
return pout;
}
@@ -205,8 +205,8 @@ static inline D3DXVECTOR3* D3DXVec3Lerp(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv
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->x = max(pv1->x , pv2->x),
+ pout->y = max(pv1->y , pv2->y),
pout->z = max(pv1->z , pv2->z);
return pout;
}
@@ -214,8 +214,8 @@ static inline D3DXVECTOR3* D3DXVec3Maximize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3
static inline D3DXVECTOR3* D3DXVec3Minimize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
- pout->x = min(pv1->x , pv2->x);
- pout->y = min(pv1->y , pv2->y);
+ pout->x = min(pv1->x , pv2->x),
+ pout->y = min(pv1->y , pv2->y),
pout->z = min(pv1->z , pv2->z);
return pout;
}
@@ -223,8 +223,8 @@ static inline D3DXVECTOR3* D3DXVec3Minimize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3
static inline D3DXVECTOR3* D3DXVec3Scale(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv, FLOAT s)
{
if ( !pout || !pv) return NULL;
- pout->x = s * (pv->x);
- pout->y = s * (pv->y);
+ pout->x = s * (pv->x),
+ pout->y = s * (pv->y),
pout->z = s * (pv->z);
return pout;
}
@@ -232,8 +232,8 @@ static inline D3DXVECTOR3* D3DXVec3Scale(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *p
static inline D3DXVECTOR3* D3DXVec3Subtract(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
- pout->x = pv1->x - pv2->x;
- pout->y = pv1->y - pv2->y;
+ pout->x = pv1->x - pv2->x,
+ pout->y = pv1->y - pv2->y,
pout->z = pv1->z - pv2->z;
return pout;
}
@@ -242,9 +242,9 @@ static inline D3DXVECTOR3* D3DXVec3Subtract(D3DXVECTOR3 *pout, CONST D3DXVECTOR3
static inline D3DXVECTOR4* D3DXVec4Add(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
- pout->x = pv1->x + pv2->x;
- pout->y = pv1->y + pv2->y;
- pout->z = pv1->z + pv2->z;
+ pout->x = pv1->x + pv2->x,
+ pout->y = pv1->y + pv2->y,
+ pout->z = pv1->z + pv2->z,
pout->w = pv1->w + pv2->w;
return pout;
}
@@ -270,9 +270,9 @@ static inline FLOAT D3DXVec4LengthSq(CONST D3DXVECTOR4 *pv)
static inline D3DXVECTOR4* D3DXVec4Lerp(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2, FLOAT s)
{
if ( !pout || !pv1 || !pv2) return NULL;
- pout->x = (1-s) * (pv1->x) + s * (pv2->x);
- pout->y = (1-s) * (pv1->y) + s * (pv2->y);
- pout->z = (1-s) * (pv1->z) + s * (pv2->z);
+ pout->x = (1-s) * (pv1->x) + s * (pv2->x),
+ pout->y = (1-s) * (pv1->y) + s * (pv2->y),
+ pout->z = (1-s) * (pv1->z) + s * (pv2->z),
pout->w = (1-s) * (pv1->w) + s * (pv2->w);
return pout;
}
@@ -281,9 +281,9 @@ static inline D3DXVECTOR4* D3DXVec4Lerp(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv
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->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;
}
@@ -291,9 +291,9 @@ static inline D3DXVECTOR4* D3DXVec4Maximize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4
static inline D3DXVECTOR4* D3DXVec4Minimize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
- pout->x = min(pv1->x , pv2->x);
- pout->y = min(pv1->y , pv2->y);
- pout->z = min(pv1->z , pv2->z);
+ pout->x = min(pv1->x , pv2->x),
+ pout->y = min(pv1->y , pv2->y),
+ pout->z = min(pv1->z , pv2->z),
pout->w = min(pv1->w , pv2->w);
return pout;
}
@@ -301,9 +301,9 @@ static inline D3DXVECTOR4* D3DXVec4Minimize(D3DXVECTOR4 *pout, CONST D3DXVECTOR4
static inline D3DXVECTOR4* D3DXVec4Scale(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv, FLOAT s)
{
if ( !pout || !pv) return NULL;
- pout->x = s * (pv->x);
- pout->y = s * (pv->y);
- pout->z = s * (pv->z);
+ pout->x = s * (pv->x),
+ pout->y = s * (pv->y),
+ pout->z = s * (pv->z),
pout->w = s * (pv->w);
return pout;
}
@@ -311,9 +311,9 @@ static inline D3DXVECTOR4* D3DXVec4Scale(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *p
static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4 *pv1, CONST D3DXVECTOR4 *pv2)
{
if ( !pout || !pv1 || !pv2) return NULL;
- pout->x = pv1->x - pv2->x;
- pout->y = pv1->y - pv2->y;
- pout->z = pv1->z - pv2->z;
+ pout->x = pv1->x - pv2->x,
+ pout->y = pv1->y - pv2->y,
+ pout->z = pv1->z - pv2->z,
pout->w = pv1->w - pv2->w;
return pout;
}
@@ -323,21 +323,21 @@ static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4
static inline D3DXMATRIX* D3DXMatrixIdentity(D3DXMATRIX *pout)
{
if ( !pout ) return NULL;
- pout->m[0][1] = 0.0f;
- pout->m[0][2] = 0.0f;
- pout->m[0][3] = 0.0f;
- pout->m[1][0] = 0.0f;
- pout->m[1][2] = 0.0f;
- pout->m[1][3] = 0.0f;
- pout->m[2][0] = 0.0f;
- pout->m[2][1] = 0.0f;
- pout->m[2][3] = 0.0f;
- pout->m[3][0] = 0.0f;
- pout->m[3][1] = 0.0f;
- pout->m[3][2] = 0.0f;
- pout->m[0][0] = 1.0f;
- pout->m[1][1] = 1.0f;
- pout->m[2][2] = 1.0f;
+ pout->m[0][1] = 0.0f,
+ pout->m[0][2] = 0.0f,
+ pout->m[0][3] = 0.0f,
+ pout->m[1][0] = 0.0f,
+ pout->m[1][2] = 0.0f,
+ pout->m[1][3] = 0.0f,
+ pout->m[2][0] = 0.0f,
+ pout->m[2][1] = 0.0f,
+ pout->m[2][3] = 0.0f,
+ pout->m[3][0] = 0.0f,
+ pout->m[3][1] = 0.0f,
+ pout->m[3][2] = 0.0f,
+ pout->m[0][0] = 1.0f,
+ pout->m[1][1] = 1.0f,
+ pout->m[2][2] = 1.0f,
pout->m[3][3] = 1.0f;
return pout;
}
@@ -346,7 +346,7 @@ static inline BOOL D3DXMatrixIsIdentity(D3DXMATRIX *pm)
{
int i,j;
D3DXMATRIX testmatrix;
- BOOL equal=TRUE;
+ BOOL equal=FALSE;
if ( !pm ) return FALSE;
D3DXMatrixIdentity(&testmatrix);
@@ -354,9 +354,11 @@ static inline BOOL D3DXMatrixIsIdentity(D3DXMATRIX *pm)
{
for (j=0; j<4; j++)
{
- if ( fabs(pm->m[i][j] - testmatrix.m[i][j]) > 0.0001 ) equal = FALSE;
+ if ( fabs(pm->m[i][j] - testmatrix.m[i][j]) > 0.0001 ) goto end;
}
}
+ equal = TRUE;
+ end:
return equal;
}
@@ -385,8 +387,8 @@ static inline FLOAT D3DXPlaneDotNormal(CONST D3DXPLANE *pp, CONST D3DXVECTOR4 *p
static inline D3DXQUATERNION* D3DXQuaternionConjugate(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq)
{
if ( !pout || !pq) return NULL;
- pout->x = -pq->x;
- pout->y = -pq->y;
+ pout->x = -pq->x,
+ pout->y = -pq->y,
pout->z = -pq->z;
pout->w = pq->w;
return pout;
@@ -401,9 +403,9 @@ static inline FLOAT D3DXQuaternionDot(CONST D3DXQUATERNION *pq1, CONST D3DXQUATE
static inline D3DXQUATERNION* D3DXQuaternionIdentity(D3DXQUATERNION *pout)
{
if ( !pout) return NULL;
- pout->x = 0.0f;
- pout->y = 0.0f;
- pout->z = 0.0f;
+ pout->x = 0.0f,
+ pout->y = 0.0f,
+ pout->z = 0.0f,
pout->w = 1.0f;
return pout;
}
--
1.5.3.2
--0-604178579-1193391217=:22298--
More information about the wine-patches
mailing list