=?UTF-8?Q?Rico=20Sch=C3=BCller=20?=: d3dx9: Apply rotationcenter only when a rotation is done.

Alexandre Julliard julliard at winehq.org
Mon Jun 17 14:07:47 CDT 2013


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

Author: Rico Schüller <kgbricola at web.de>
Date:   Mon Jun 17 09:56:20 2013 +0200

d3dx9: Apply rotationcenter only when a rotation is done.

---

 dlls/d3dx9_36/math.c |   29 ++++++-----------------------
 1 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/dlls/d3dx9_36/math.c b/dlls/d3dx9_36/math.c
index 43911e9..e0cab9e 100644
--- a/dlls/d3dx9_36/math.c
+++ b/dlls/d3dx9_36/math.c
@@ -102,13 +102,6 @@ D3DXMATRIX * WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *out, FLOAT scalin
 
     D3DXMatrixIdentity(out);
 
-    if (rotationcenter)
-    {
-        out->u.m[3][0] = -rotationcenter->x;
-        out->u.m[3][1] = -rotationcenter->y;
-        out->u.m[3][2] = -rotationcenter->z;
-    }
-
     if (rotation)
     {
         FLOAT temp00, temp01, temp02, temp10, temp11, temp12, temp20, temp21, temp22;
@@ -135,15 +128,12 @@ D3DXMATRIX * WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *out, FLOAT scalin
 
         if (rotationcenter)
         {
-            FLOAT x, y, z;
-
-            x = out->u.m[3][0];
-            y = out->u.m[3][1];
-            z = out->u.m[3][2];
-
-            out->u.m[3][0] = x * temp00 + y * temp10 + z * temp20;
-            out->u.m[3][1] = x * temp01 + y * temp11 + z * temp21;
-            out->u.m[3][2] = x * temp02 + y * temp12 + z * temp22;
+            out->u.m[3][0] = rotationcenter->x * (1.0f - temp00) - rotationcenter->y * temp10
+                    - rotationcenter->z * temp20;
+            out->u.m[3][1] = rotationcenter->y * (1.0f - temp11) - rotationcenter->x * temp01
+                    - rotationcenter->z * temp21;
+            out->u.m[3][2] = rotationcenter->z * (1.0f - temp22) - rotationcenter->x * temp02
+                    - rotationcenter->y * temp12;
         }
     }
     else
@@ -153,13 +143,6 @@ D3DXMATRIX * WINAPI D3DXMatrixAffineTransformation(D3DXMATRIX *out, FLOAT scalin
         out->u.m[2][2] = scaling;
     }
 
-    if (rotationcenter)
-    {
-        out->u.m[3][0] += rotationcenter->x;
-        out->u.m[3][1] += rotationcenter->y;
-        out->u.m[3][2] += rotationcenter->z;
-    }
-
     if (translation)
     {
         out->u.m[3][0] += translation->x;




More information about the wine-cvs mailing list