d3dx8: Make expect_mat a bit more useable.

This commit is contained in:
Henri Verbeet 2008-10-30 17:38:55 +01:00 committed by Alexandre Julliard
parent 253d89b954
commit bbc2f7d713
1 changed files with 59 additions and 52 deletions

View File

@ -25,31 +25,38 @@
#define expect_color(expectedcolor,gotcolor) ok((fabs(expectedcolor.r-gotcolor.r)<admitted_error)&&(fabs(expectedcolor.g-gotcolor.g)<admitted_error)&&(fabs(expectedcolor.b-gotcolor.b)<admitted_error)&&(fabs(expectedcolor.a-gotcolor.a)<admitted_error),"Expected Color= (%f, %f, %f, %f)\n , Got Color= (%f, %f, %f, %f)\n", expectedcolor.r, expectedcolor.g, expectedcolor.b, expectedcolor.a, gotcolor.r, gotcolor.g, gotcolor.b, gotcolor.a);
#define expect_mat(expectedmat,gotmat)\
{ \
int i,j,equal=1; \
for (i=0; i<4; i++)\
{\
for (j=0; j<4; j++)\
{\
if (fabs(U(expectedmat).m[i][j]-U(gotmat).m[i][j])>admitted_error) \
{\
equal=0;\
}\
}\
}\
ok(equal, "Expected matrix=\n(%f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f\n)\n\n" \
"Got matrix=\n(%f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f)\n", \
U(expectedmat).m[0][0],U(expectedmat).m[0][1],U(expectedmat).m[0][2],U(expectedmat).m[0][3], \
U(expectedmat).m[1][0],U(expectedmat).m[1][1],U(expectedmat).m[1][2],U(expectedmat).m[1][3], \
U(expectedmat).m[2][0],U(expectedmat).m[2][1],U(expectedmat).m[2][2],U(expectedmat).m[2][3], \
U(expectedmat).m[3][0],U(expectedmat).m[3][1],U(expectedmat).m[3][2],U(expectedmat).m[3][3], \
U(gotmat).m[0][0],U(gotmat).m[0][1],U(gotmat).m[0][2],U(gotmat).m[0][3], \
U(gotmat).m[1][0],U(gotmat).m[1][1],U(gotmat).m[1][2],U(gotmat).m[1][3], \
U(gotmat).m[2][0],U(gotmat).m[2][1],U(gotmat).m[2][2],U(gotmat).m[2][3], \
U(gotmat).m[3][0],U(gotmat).m[3][1],U(gotmat).m[3][2],U(gotmat).m[3][3]); \
static inline BOOL compare_matrix(const D3DXMATRIX *m1, const D3DXMATRIX *m2)
{
int i, j;
for (i = 0; i < 4; ++i)
{
for (j = 0; j < 4; ++j)
{
if (fabs(U(m1)->m[i][j] - U(m2)->m[i][j]) > admitted_error)
return FALSE;
}
}
return TRUE;
}
#define expect_mat(expectedmat, gotmat) \
do { \
const D3DXMATRIX *__m1 = (expectedmat); \
const D3DXMATRIX *__m2 = (gotmat); \
ok(compare_matrix(__m1, __m2), "Expected matrix=\n(%f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f\n)\n\n" \
"Got matrix=\n(%f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f\n %f,%f,%f,%f)\n", \
U(__m1)->m[0][0], U(__m1)->m[0][1], U(__m1)->m[0][2], U(__m1)->m[0][3], \
U(__m1)->m[1][0], U(__m1)->m[1][1], U(__m1)->m[1][2], U(__m1)->m[1][3], \
U(__m1)->m[2][0], U(__m1)->m[2][1], U(__m1)->m[2][2], U(__m1)->m[2][3], \
U(__m1)->m[3][0], U(__m1)->m[3][1], U(__m1)->m[3][2], U(__m1)->m[3][3], \
U(__m2)->m[0][0], U(__m2)->m[0][1], U(__m2)->m[0][2], U(__m2)->m[0][3], \
U(__m2)->m[1][0], U(__m2)->m[1][1], U(__m2)->m[1][2], U(__m2)->m[1][3], \
U(__m2)->m[2][0], U(__m2)->m[2][1], U(__m2)->m[2][2], U(__m2)->m[2][3], \
U(__m2)->m[3][0], U(__m2)->m[3][1], U(__m2)->m[3][2], U(__m2)->m[3][3]); \
} while(0)
#define expect_plane(expectedplane,gotplane) ok((fabs(expectedplane.a-gotplane.a)<admitted_error)&&(fabs(expectedplane.b-gotplane.b)<admitted_error)&&(fabs(expectedplane.c-gotplane.c)<admitted_error)&&(fabs(expectedplane.d-gotplane.d)<admitted_error),"Expected Plane= (%f, %f, %f, %f)\n , Got Plane= (%f, %f, %f, %f)\n", expectedplane.a, expectedplane.b, expectedplane.c, expectedplane.d, gotplane.a, gotplane.b, gotplane.c, gotplane.d);
#define expect_vec(expectedvec,gotvec) ok((fabs(expectedvec.x-gotvec.x)<admitted_error)&&(fabs(expectedvec.y-gotvec.y)<admitted_error),"Expected Vector= (%f, %f)\n , Got Vector= (%f, %f)\n", expectedvec.x, expectedvec.y, gotvec.x, gotvec.y);
@ -205,14 +212,14 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 363.119995f; U(expectedmat).m[2][1] = -121.040001f; U(expectedmat).m[2][2] = -117.479996f; U(expectedmat).m[2][3] = 0.0f;
U(expectedmat).m[3][0] = -1239.0f; U(expectedmat).m[3][1] = 667.0f; U(expectedmat).m[3][2] = 567.0f; U(expectedmat).m[3][3] = 1.0f;
D3DXMatrixAffineTransformation(&gotmat,3.56f,&at,&q,&axis);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/* Test the NULL case */
U(expectedmat).m[0][0] = -459.239990f; U(expectedmat).m[0][1] = -576.719971f; U(expectedmat).m[0][2] = -263.440002f; U(expectedmat).m[0][3] = 0.0f;
U(expectedmat).m[1][0] = 519.760010f; U(expectedmat).m[1][1] = -352.440002f; U(expectedmat).m[1][2] = -277.679993f; U(expectedmat).m[1][3] = 0.0f;
U(expectedmat).m[2][0] = 363.119995f; U(expectedmat).m[2][1] = -121.040001f; U(expectedmat).m[2][2] = -117.479996f; U(expectedmat).m[2][3] = 0.0f;
U(expectedmat).m[3][0] = 1.0f; U(expectedmat).m[3][1] = -3.0f; U(expectedmat).m[3][2] = 7.0f; U(expectedmat).m[3][3] = 1.0f;
D3DXMatrixAffineTransformation(&gotmat,3.56f,NULL,&q,&axis);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixfDeterminant_____________*/
expectedfloat = -147888.0f;
@ -226,7 +233,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[3][0] = 163.0f/5688.0f; U(expectedmat).m[3][1] = -101.0f/11376.0f; U(expectedmat).m[3][2] = -73.0f/11376.0f; U(expectedmat).m[3][3] = -127.0f/3792.0f;
expectedfloat = -147888.0f;
D3DXMatrixInverse(&gotmat,&determinant,&mat);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
ok(fabs( determinant - expectedfloat ) < admitted_error, "Expected: %f, Got: %f\n", expectedfloat, determinant);
funcpointer = D3DXMatrixInverse(&gotmat,NULL,&mat2);
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
@ -255,7 +262,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = -0.120729f; U(expectedmat).m[2][1] = 0.803935f; U(expectedmat).m[2][2] = -0.582335f; U(expectedmat).m[2][3] = 0.0f;
U(expectedmat).m[3][0] = 4.494634f; U(expectedmat).m[3][1] = 0.809719f; U(expectedmat).m[3][2] = 10.060076f; U(expectedmat).m[3][3] = 1.0f;
D3DXMatrixLookAtLH(&gotmat,&eye,&at,&axis);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixLookatRH_______________*/
U(expectedmat).m[0][0] = 0.822465f; U(expectedmat).m[0][1] = -0.409489f; U(expectedmat).m[0][2] = 0.394803f; U(expectedmat).m[0][3] = 0.0f;
@ -263,7 +270,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 0.120729f; U(expectedmat).m[2][1] = 0.803935f; U(expectedmat).m[2][2] = 0.582335f; U(expectedmat).m[2][3] = 0.0f;
U(expectedmat).m[3][0] = -4.494634f; U(expectedmat).m[3][1] = 0.809719f; U(expectedmat).m[3][2] = -10.060076f; U(expectedmat).m[3][3] = 1.0f;
D3DXMatrixLookAtRH(&gotmat,&eye,&at,&axis);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixMultiply______________*/
U(expectedmat).m[0][0] = 73.0f; U(expectedmat).m[0][1] = 193.0f; U(expectedmat).m[0][2] = -197.0f; U(expectedmat).m[0][3] = -77.0f;
@ -271,7 +278,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 239.0f; U(expectedmat).m[2][1] = 523.0f; U(expectedmat).m[2][2] = -400.0f; U(expectedmat).m[2][3] = -116.0f;
U(expectedmat).m[3][0] = -164.0f; U(expectedmat).m[3][1] = -320.0f; U(expectedmat).m[3][2] = 187.0f; U(expectedmat).m[3][3] = 31.0f;
D3DXMatrixMultiply(&gotmat,&mat,&mat2);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixMultiplyTranspose____*/
U(expectedmat).m[0][0] = 73.0f; U(expectedmat).m[0][1] = 231.0f; U(expectedmat).m[0][2] = 239.0f; U(expectedmat).m[0][3] = -164.0f;
@ -279,7 +286,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = -197.0f; U(expectedmat).m[2][1] = -489.0f; U(expectedmat).m[2][2] = -400.0f; U(expectedmat).m[2][3] = 187.0f;
U(expectedmat).m[3][0] = -77.0f; U(expectedmat).m[3][1] = -169.0f; U(expectedmat).m[3][2] = -116.0f; U(expectedmat).m[3][3] = 31.0f;
D3DXMatrixMultiplyTranspose(&gotmat,&mat,&mat2);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixOrthoLH_______________*/
U(expectedmat).m[0][0] = 0.8f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
@ -287,7 +294,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = -0.151515f; U(expectedmat).m[2][3] = 0.0f;
U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = -0.484848f; U(expectedmat).m[3][3] = 1.0f;
D3DXMatrixOrthoLH(&gotmat, 2.5f, 7.4f, -3.2f, -9.8f);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixOrthoOffCenterLH_______________*/
U(expectedmat).m[0][0] = 3.636364f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
@ -295,7 +302,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = -0.045662f; U(expectedmat).m[2][3] = 0.0f;
U(expectedmat).m[3][0] = -1.727272f; U(expectedmat).m[3][1] = -0.567568f; U(expectedmat).m[3][2] = 0.424658f; U(expectedmat).m[3][3] = 1.0f;
D3DXMatrixOrthoOffCenterLH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f, 9.3, -12.6);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixOrthoOffCenterRH_______________*/
U(expectedmat).m[0][0] = 3.636364f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
@ -303,7 +310,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = 0.045662f; U(expectedmat).m[2][3] = 0.0f;
U(expectedmat).m[3][0] = -1.727272f; U(expectedmat).m[3][1] = -0.567568f; U(expectedmat).m[3][2] = 0.424658f; U(expectedmat).m[3][3] = 1.0f;
D3DXMatrixOrthoOffCenterRH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f, 9.3, -12.6);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixOrthoRH_______________*/
U(expectedmat).m[0][0] = 0.8f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
@ -311,7 +318,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = 0.151515f; U(expectedmat).m[2][3] = 0.0f;
U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = -0.484848f; U(expectedmat).m[3][3] = 1.0f;
D3DXMatrixOrthoRH(&gotmat, 2.5f, 7.4f, -3.2f, -9.8f);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixPerspectiveFovLH_______________*/
U(expectedmat).m[0][0] = 13.288858f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
@ -319,7 +326,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = 0.783784f; U(expectedmat).m[2][3] = 1.0f;
U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 1.881081f; U(expectedmat).m[3][3] = 0.0f;
D3DXMatrixPerspectiveFovLH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixPerspectiveFovRH_______________*/
U(expectedmat).m[0][0] = 13.288858f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
@ -327,7 +334,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = -0.783784f; U(expectedmat).m[2][3] = -1.0f;
U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 1.881081f; U(expectedmat).m[3][3] = 0.0f;
D3DXMatrixPerspectiveFovRH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixPerspectiveLH_______________*/
U(expectedmat).m[0][0] = -24.0f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
@ -335,7 +342,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = 0.783784f; U(expectedmat).m[2][3] = 1.0f;
U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 1.881081f; U(expectedmat).m[3][3] = 0.0f;
D3DXMatrixPerspectiveLH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixPerspectiveOffCenterLH_______________*/
U(expectedmat).m[0][0] = 11.636364f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
@ -343,7 +350,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = -1.727273f; U(expectedmat).m[2][1] = -0.567568f; U(expectedmat).m[2][2] = 0.840796f; U(expectedmat).m[2][3] = 1.0f;
U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = -2.690547f; U(expectedmat).m[3][3] = 0.0f;
D3DXMatrixPerspectiveOffCenterLH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f, 3.2f, -16.9f);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixPerspectiveOffCenterRH_______________*/
U(expectedmat).m[0][0] = 11.636364f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
@ -351,7 +358,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 1.727273f; U(expectedmat).m[2][1] = 0.567568f; U(expectedmat).m[2][2] = -0.840796f; U(expectedmat).m[2][3] = -1.0f;
U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = -2.690547f; U(expectedmat).m[3][3] = 0.0f;
D3DXMatrixPerspectiveOffCenterRH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f, 3.2f, -16.9f);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixPerspectiveRH_______________*/
U(expectedmat).m[0][0] = -24.0f; U(expectedmat).m[0][1] = -0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
@ -359,7 +366,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = -0.783784f; U(expectedmat).m[2][3] = -1.0f;
U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 1.881081f; U(expectedmat).m[3][3] = 0.0f;
D3DXMatrixPerspectiveRH(&gotmat, 0.2f, 0.75f, -2.4f, 8.7f);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixReflect______________*/
U(expectedmat).m[0][0] = 0.307692f; U(expectedmat).m[0][1] = -0.230769f; U(expectedmat).m[0][2] = 0.923077f; U(expectedmat).m[0][3] = 0.0f;
@ -367,7 +374,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 0.923077f; U(expectedmat).m[2][1] = 0.307693f; U(expectedmat).m[2][2] = -0.230769f; U(expectedmat).m[2][3] = 0.0f;
U(expectedmat).m[3][0] = 1.615385f; U(expectedmat).m[3][1] = 0.538462f; U(expectedmat).m[3][2] = -2.153846f; U(expectedmat).m[3][3] = 1.0f;
D3DXMatrixReflect(&gotmat,&plane);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixRotationAxis_____*/
U(expectedmat).m[0][0] = 0.508475f; U(expectedmat).m[0][1] = 0.763805f; U(expectedmat).m[0][2] = 0.397563f; U(expectedmat).m[0][3] = 0.0f;
@ -375,7 +382,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = -0.278919f; U(expectedmat).m[2][1] = -0.290713f; U(expectedmat).m[2][2] = 0.915254f; U(expectedmat).m[2][3] = 0.0f;
U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 0.0f; U(expectedmat).m[3][3] = 1.0f;
D3DXMatrixRotationAxis(&gotmat,&axis,angle);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixRotationQuaternion______________*/
U(expectedmat).m[0][0] = -129.0f; U(expectedmat).m[0][1] = -162.0f; U(expectedmat).m[0][2] = -74.0f; U(expectedmat).m[0][3] = 0.0f;
@ -383,7 +390,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 102.0f; U(expectedmat).m[2][1] = -34.0f; U(expectedmat).m[2][2] = -33.0f; U(expectedmat).m[2][3] = 0.0f;
U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 0.0f; U(expectedmat).m[3][3] = 1.0f;
D3DXMatrixRotationQuaternion(&gotmat,&q);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixRotationX______________*/
U(expectedmat).m[0][0] = 1.0f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
@ -391,7 +398,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = -sqrt(3.0f)/2.0f; U(expectedmat).m[2][2] = 0.5f; U(expectedmat).m[2][3] = 0.0f;
U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 0.0f; U(expectedmat).m[3][3] = 1.0f;
D3DXMatrixRotationX(&gotmat,angle);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixRotationY______________*/
U(expectedmat).m[0][0] = 0.5f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = -sqrt(3.0f)/2.0f; U(expectedmat).m[0][3] = 0.0f;
@ -399,7 +406,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = sqrt(3.0f)/2.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = 0.5f; U(expectedmat).m[2][3] = 0.0f;
U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 0.0f; U(expectedmat).m[3][3] = 1.0f;
D3DXMatrixRotationY(&gotmat,angle);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixRotationYawPitchRoll____*/
U(expectedmat).m[0][0] = 0.888777f; U(expectedmat).m[0][1] = 0.091875f; U(expectedmat).m[0][2] = -0.449037f; U(expectedmat).m[0][3] = 0.0f;
@ -407,7 +414,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 0.293893f; U(expectedmat).m[2][1] = -0.866025f; U(expectedmat).m[2][2] = 0.404509f; U(expectedmat).m[2][3] = 0.0f;
U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 0.0f; U(expectedmat).m[3][3] = 1.0f;
D3DXMatrixRotationYawPitchRoll(&gotmat, 3.0f*angle/5.0f, angle, 3.0f*angle/17.0f);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixRotationZ______________*/
U(expectedmat).m[0][0] = 0.5f; U(expectedmat).m[0][1] = sqrt(3.0f)/2.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
@ -415,7 +422,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = 1.0f; U(expectedmat).m[2][3] = 0.0f;
U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 0.0f; U(expectedmat).m[3][3] = 1.0f;
D3DXMatrixRotationZ(&gotmat,angle);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixScaling______________*/
U(expectedmat).m[0][0] = 0.69f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
@ -423,7 +430,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = 4.11f; U(expectedmat).m[2][3] = 0.0f;
U(expectedmat).m[3][0] = 0.0f; U(expectedmat).m[3][1] = 0.0f; U(expectedmat).m[3][2] = 0.0f; U(expectedmat).m[3][3] = 1.0f;
D3DXMatrixScaling(&gotmat,0.69f,0.53f,4.11f);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixShadow______________*/
U(expectedmat).m[0][0] = 12.786773f; U(expectedmat).m[0][1] = 5.000961f; U(expectedmat).m[0][2] = 4.353778f; U(expectedmat).m[0][3] = 3.706595f;
@ -431,7 +438,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = -7.530860f; U(expectedmat).m[2][1] = -6.667949f; U(expectedmat).m[2][2] = 1.333590f; U(expectedmat).m[2][3] = -4.942127f;
U(expectedmat).m[3][0] = -13.179006f; U(expectedmat).m[3][1] = -11.668910f; U(expectedmat).m[3][2] = -10.158816f; U(expectedmat).m[3][3] = -1.510094f;
D3DXMatrixShadow(&gotmat,&light,&plane);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixTransformation______________*/
U(expectedmat).m[0][0] = -0.2148f; U(expectedmat).m[0][1] = 1.3116f; U(expectedmat).m[0][2] = 0.4752f; U(expectedmat).m[0][3] = 0.0f;
@ -439,7 +446,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 1.0212f; U(expectedmat).m[2][1] = 0.1936f; U(expectedmat).m[2][2] = -1.3588f; U(expectedmat).m[2][3] = 0.0f;
U(expectedmat).m[3][0] = 18.2985f; U(expectedmat).m[3][1] = -29.624001f; U(expectedmat).m[3][2] = 15.683499f; U(expectedmat).m[3][3] = 1.0f;
D3DXMatrixTransformation(&gotmat,&at,&q,NULL,&eye,&r,&last);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixTranslation______________*/
U(expectedmat).m[0][0] = 1.0f; U(expectedmat).m[0][1] = 0.0f; U(expectedmat).m[0][2] = 0.0f; U(expectedmat).m[0][3] = 0.0f;
@ -447,7 +454,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 0.0f; U(expectedmat).m[2][1] = 0.0f; U(expectedmat).m[2][2] = 1.0f; U(expectedmat).m[2][3] = 0.0f;
U(expectedmat).m[3][0] = 0.69f; U(expectedmat).m[3][1] = 0.53f; U(expectedmat).m[3][2] = 4.11f; U(expectedmat).m[3][3] = 1.0f;
D3DXMatrixTranslation(&gotmat,0.69f,0.53f,4.11f);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
/*____________D3DXMatrixTranspose______________*/
U(expectedmat).m[0][0] = 10.0f; U(expectedmat).m[0][1] = 11.0f; U(expectedmat).m[0][2] = 19.0f; U(expectedmat).m[0][3] = 2.0f;
@ -455,7 +462,7 @@ static void D3DXMatrixTest(void)
U(expectedmat).m[2][0] = 7.0f; U(expectedmat).m[2][1] = 16.0f; U(expectedmat).m[2][2] = 30.f; U(expectedmat).m[2][3] = -4.0f;
U(expectedmat).m[3][0] = 8.0f; U(expectedmat).m[3][1] = 33.0f; U(expectedmat).m[3][2] = 43.0f; U(expectedmat).m[3][3] = -40.0f;
D3DXMatrixTranspose(&gotmat,&mat);
expect_mat(expectedmat,gotmat);
expect_mat(&expectedmat, &gotmat);
}
static void D3DXPlaneTest(void)