[PATCH] Implement D3DXMatrixScaling with a test
David Adam
David.Adam at math.cnrs.fr
Tue Oct 30 09:24:17 CDT 2007
---
dlls/d3dx8/d3dx8.spec | 2 +-
dlls/d3dx8/math.c | 9 +++++++++
dlls/d3dx8/tests/math.c | 8 ++++++++
include/d3dx8math.h | 1 +
4 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/dlls/d3dx8/d3dx8.spec b/dlls/d3dx8/d3dx8.spec
index 5a5efeb..1e2d68c 100644
--- a/dlls/d3dx8/d3dx8.spec
+++ b/dlls/d3dx8/d3dx8.spec
@@ -24,7 +24,7 @@
@ stdcall D3DXMatrixMultiply(ptr ptr ptr)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stub D3DXMatrixInverse
-@ stub D3DXMatrixScaling
+@ stdcall D3DXMatrixScaling(ptr long long long)
@ stub D3DXMatrixTranslation
@ stub D3DXMatrixRotationX
@ stub D3DXMatrixRotationY
diff --git a/dlls/d3dx8/math.c b/dlls/d3dx8/math.c
index 7ce5e21..fd82774 100644
--- a/dlls/d3dx8/math.c
+++ b/dlls/d3dx8/math.c
@@ -58,6 +58,15 @@ D3DXMATRIX* WINAPI D3DXMatrixMultiply(D3DXMATRIX *pout, C=
ONST D3DXMATRIX *pm1, C
return pout;
}
=20
+D3DXMATRIX* WINAPI D3DXMatrixScaling(D3DXMATRIX *pout, FLOAT sx, FLOAT sy, =
FLOAT sz)
+{
+ D3DXMatrixIdentity(pout);
+ pout->m[0][0] =3D sx;
+ pout->m[1][1] =3D sy;
+ pout->m[2][2] =3D sz;
+ return pout;
+}
+
D3DXMATRIX* WINAPI D3DXMatrixTranspose(D3DXMATRIX *pout, CONST D3DXMATRIX *=
pm)
{
int i,j;
diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c
index 8c35b55..a1ffc23 100644
--- a/dlls/d3dx8/tests/math.c
+++ b/dlls/d3dx8/tests/math.c
@@ -196,6 +196,14 @@ static void D3DXMatrixTest(void)
D3DXMatrixMultiply(&gotmat,&mat,&mat2);
expect_mat(expectedmat,gotmat);
=20
+/*____________D3DXMatrixScaling______________*/
+ expectedmat.m[0][0] =3D 0.69f; expectedmat.m[0][1] =3D 0.0f; expectedma=
t.m[0][2] =3D 0.0f; expectedmat.m[0][3] =3D 0.0f;
+ expectedmat.m[1][0] =3D 0.0; expectedmat.m[1][1] =3D 0.53f; expectedmat=
.m[1][2] =3D 0.0f; expectedmat.m[1][3] =3D 0.0f;
+ expectedmat.m[2][0] =3D 0.0f; expectedmat.m[2][1] =3D 0.0f; expectedmat=
.m[2][2] =3D 4.11f; expectedmat.m[2][3] =3D 0.0f;
+ expectedmat.m[3][0] =3D 0.0f; expectedmat.m[3][1] =3D 0.0f; expectedmat=
.m[3][2] =3D 0.0f; expectedmat.m[3][3] =3D 1.0f;
+ D3DXMatrixScaling(&gotmat,0.69f,0.53f,4.11f);
+ 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;
diff --git a/include/d3dx8math.h b/include/d3dx8math.h
index fda908e..dab1899 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 D3DXMatrixScaling(D3DXMATRIX *pout, FLOAT sx, FLOAT sy, =
FLOAT sz);
D3DXMATRIX* WINAPI D3DXMatrixTranspose(D3DXMATRIX *pout, CONST D3DXMATRIX *=
pm);
=20
D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST =
D3DXQUATERNION *pq);
--=20
1.5.3.2
--=_2ck9e2rcsge8--
More information about the wine-patches
mailing list