[PATCH] Implement D3DXMatrixTranspose with a test

David Adam David.Adam at math.cnrs.fr
Tue Oct 30 09:16:12 CDT 2007


---
 dlls/d3dx8/d3dx8.spec   |    2 +-
 dlls/d3dx8/math.c       |   14 ++++++++++++++
 dlls/d3dx8/tests/math.c |    8 ++++++++
 include/d3dx8math.h     |    1 +
 4 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/dlls/d3dx8/d3dx8.spec b/dlls/d3dx8/d3dx8.spec
index 808e509..5a5efeb 100644
--- a/dlls/d3dx8/d3dx8.spec
+++ b/dlls/d3dx8/d3dx8.spec
@@ -22,7 +22,7 @@
 @ stdcall D3DXVec4Transform(ptr ptr ptr)
 @ stdcall D3DXMatrixfDeterminant(ptr)
 @ stdcall D3DXMatrixMultiply(ptr ptr ptr)
-@ stub D3DXMatrixTranspose
+@ stdcall D3DXMatrixTranspose(ptr ptr)
 @ stub D3DXMatrixInverse
 @ stub D3DXMatrixScaling
 @ stub D3DXMatrixTranslation
diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c
index 3c46581..7ce5e21 100644
--- a/dlls/d3dx8/math.c
+++ b/dlls/d3dx8/math.c
@@ -58,6 +58,20 @@ D3DXMATRIX* WINAPI D3DXMatrixMultiply(D3DXMATRIX *pout, C=
ONST D3DXMATRIX *pm1, C
     return pout;
 }
=20
+D3DXMATRIX* WINAPI D3DXMatrixTranspose(D3DXMATRIX *pout, CONST D3DXMATRIX *=
pm)
+{
+    int i,j;
+
+    for (i=3D0; i<4; i++)
+    {
+     for (j=3D0; j<4; j++)
+     {
+      pout->m[i][j] =3D pm->m[j][i];
+     }
+    }
+    return pout;
+}
+
 /*_________________D3DXQUATERNION________________*/
=20
 D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST =
D3DXQUATERNION *pq)
diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index fbfe46d..8c35b55 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -195,6 +195,14 @@ static void D3DXMatrixTest(void)
     expectedmat.m[3][0] =3D -164.0f; expectedmat.m[3][1] =3D -320.0f; expec=
tedmat.m[3][2] =3D 187.0f; expectedmat.m[3][3] =3D 31.0f;
     D3DXMatrixMultiply(&gotmat,&mat,&mat2);
     expect_mat(expectedmat,gotmat);
+
+/*____________D3DXMatrixTranspose______________*/
+    expectedmat.m[0][0] =3D 10.0f; expectedmat.m[0][1] =3D 11.0f; expectedm=
at.m[0][2] =3D 19.0f; expectedmat.m[0][3] =3D 2.0f;
+    expectedmat.m[1][0] =3D 5.0; expectedmat.m[1][1] =3D 20.0f; expectedmat=
.m[1][2] =3D -21.0f; expectedmat.m[1][3] =3D 3.0f;
+    expectedmat.m[2][0] =3D 7.0f; expectedmat.m[2][1] =3D 16.0f; expectedma=
t.m[2][2] =3D 30.f; expectedmat.m[2][3] =3D -4.0f;
+    expectedmat.m[3][0] =3D 8.0f; expectedmat.m[3][1] =3D 33.0f; expectedma=
t.m[3][2] =3D 43.0f; expectedmat.m[3][3] =3D -40.0f;
+    D3DXMatrixTranspose(&gotmat,&mat);
+    expect_mat(expectedmat,gotmat);
 }
=20
 static void D3DXPlaneTest(void)
diff --git a/include/d3dx8math.h b/include/d3dx8math.h
index 94a9cfd..fda908e 100644
--- a/include/d3dx8math.h
+++ b/include/d3dx8math.h
@@ -60,6 +60,7 @@ typedef struct D3DXCOLOR
=20
 FLOAT WINAPI D3DXMatrixfDeterminant(CONST D3DXMATRIX *pm);
 D3DXMATRIX* WINAPI D3DXMatrixMultiply(D3DXMATRIX *pout, CONST D3DXMATRIX *p=
m1, CONST D3DXMATRIX *pm2);
+D3DXMATRIX* WINAPI D3DXMatrixTranspose(D3DXMATRIX *pout, CONST D3DXMATRIX *=
pm);
=20
 D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST =
D3DXQUATERNION *pq);
=20
--=20
1.5.3.2


--=_2fb2utiey668--



More information about the wine-patches mailing list