Commit 5edd2cfa authored by David Adam's avatar David Adam Committed by Alexandre Julliard

d3dx8: Implement D3DXPlaneMatrixIsIdentity.

parent 73f59692
......@@ -122,6 +122,33 @@ static void D3DXColorTest(void)
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
}
static void D3DXMatrixTest(void)
{
D3DXMATRIX mat;
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[3][3] = 1.0f;
expected = FALSE;
got = D3DXMatrixIsIdentity(&mat);
ok(expected == got, "Expected : %d, Got : %d\n", expected, got);
D3DXMatrixIdentity(&mat);
expected = TRUE;
got = D3DXMatrixIsIdentity(&mat);
ok(expected == got, "Expected : %d, Got : %d\n", expected, got);
/* Test the NULL case */
expected = FALSE;
got = D3DXMatrixIsIdentity(NULL);
ok(expected == got, "Expected : %d, Got : %d\n", expected, got);
}
static void D3DXPlaneTest(void)
{
D3DXPLANE plane;
......@@ -566,6 +593,7 @@ static void D3X8Vector4Test(void)
START_TEST(math)
{
D3DXColorTest();
D3DXMatrixTest();
D3DXPlaneTest();
D3X8QuaternionTest();
D3X8Vector2Test();
......
......@@ -320,7 +320,7 @@ static inline D3DXVECTOR4* D3DXVec4Subtract(D3DXVECTOR4 *pout, CONST D3DXVECTOR4
/*__________________D3DXMatrix____________________*/
static inline D3DXMATRIX* D3DXMatrixIdentity(D3DXMATRIX *pout )
static inline D3DXMATRIX* D3DXMatrixIdentity(D3DXMATRIX *pout)
{
if ( !pout ) return NULL;
pout->m[0][1] = 0.0f;
......@@ -342,6 +342,23 @@ static inline D3DXMATRIX* D3DXMatrixIdentity(D3DXMATRIX *pout )
return pout;
}
static inline BOOL D3DXMatrixIsIdentity(D3DXMATRIX *pm)
{
int i,j;
D3DXMATRIX testmatrix;
BOOL equal=TRUE;
if ( !pm ) return FALSE;
D3DXMatrixIdentity(&testmatrix);
for (i=0; i<4; i++)
{
for (j=0; j<4; j++)
{
if ( fabs(pm->m[i][j] - testmatrix.m[i][j]) > 0.0001 ) equal = FALSE;
}
}
return equal;
}
/*__________________D3DXPLANE____________________*/
......
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