David Adam : d3dx8: Implement D3DXMatrixScaling.

Alexandre Julliard julliard at winehq.org
Wed Oct 31 08:35:25 CDT 2007


Module: wine
Branch: master
Commit: 716862d6961193306f0f5160eb0be755388efcfd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=716862d6961193306f0f5160eb0be755388efcfd

Author: David Adam <David.Adam at math.cnrs.fr>
Date:   Tue Oct 30 15:24:17 2007 +0100

d3dx8: Implement D3DXMatrixScaling.

---

 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, CONST D3DXMATRIX *pm1, C
     return pout;
 }
 
+D3DXMATRIX* WINAPI D3DXMatrixScaling(D3DXMATRIX *pout, FLOAT sx, FLOAT sy, FLOAT sz)
+{
+    D3DXMatrixIdentity(pout);
+    pout->m[0][0] = sx;
+    pout->m[1][1] = sy;
+    pout->m[2][2] = 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);
 
+/*____________D3DXMatrixScaling______________*/
+    expectedmat.m[0][0] = 0.69f; expectedmat.m[0][1] = 0.0f; expectedmat.m[0][2] = 0.0f; expectedmat.m[0][3] = 0.0f;
+    expectedmat.m[1][0] = 0.0; expectedmat.m[1][1] = 0.53f; expectedmat.m[1][2] = 0.0f; expectedmat.m[1][3] = 0.0f;
+    expectedmat.m[2][0] = 0.0f; expectedmat.m[2][1] = 0.0f; expectedmat.m[2][2] = 4.11f; expectedmat.m[2][3] = 0.0f;
+    expectedmat.m[3][0] = 0.0f; expectedmat.m[3][1] = 0.0f; expectedmat.m[3][2] = 0.0f; expectedmat.m[3][3] = 1.0f;
+    D3DXMatrixScaling(&gotmat,0.69f,0.53f,4.11f);
+    expect_mat(expectedmat,gotmat);
+
 /*____________D3DXMatrixTranspose______________*/
     expectedmat.m[0][0] = 10.0f; expectedmat.m[0][1] = 11.0f; expectedmat.m[0][2] = 19.0f; expectedmat.m[0][3] = 2.0f;
     expectedmat.m[1][0] = 5.0; expectedmat.m[1][1] = 20.0f; expectedmat.m[1][2] = -21.0f; expectedmat.m[1][3] = 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
 
 FLOAT WINAPI D3DXMatrixfDeterminant(CONST D3DXMATRIX *pm);
 D3DXMATRIX* WINAPI D3DXMatrixMultiply(D3DXMATRIX *pout, CONST D3DXMATRIX *pm1, CONST D3DXMATRIX *pm2);
+D3DXMATRIX* WINAPI D3DXMatrixScaling(D3DXMATRIX *pout, FLOAT sx, FLOAT sy, FLOAT sz);
 D3DXMATRIX* WINAPI D3DXMatrixTranspose(D3DXMATRIX *pout, CONST D3DXMATRIX *pm);
 
 D3DXQUATERNION* WINAPI D3DXQuaternionNormalize(D3DXQUATERNION *pout, CONST D3DXQUATERNION *pq);




More information about the wine-cvs mailing list