Commit 9a139206 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

d3dx9_36: Fix compilation on systems that don't support nameless unions.

parent 305a4894
......@@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define NONAMELESSUNION
#include "config.h"
#include "windef.h"
#include "wingdi.h"
......@@ -40,25 +42,25 @@ HRESULT WINAPI D3DXMatrixDecompose(D3DXVECTOR3 *poutscale, D3DXQUATERNION *poutr
}
/*Compute the scaling part.*/
vec.x=pm->m[0][0];
vec.y=pm->m[0][1];
vec.z=pm->m[0][2];
vec.x=pm->u.m[0][0];
vec.y=pm->u.m[0][1];
vec.z=pm->u.m[0][2];
poutscale->x=D3DXVec3Length(&vec);
vec.x=pm->m[1][0];
vec.y=pm->m[1][1];
vec.z=pm->m[1][2];
vec.x=pm->u.m[1][0];
vec.y=pm->u.m[1][1];
vec.z=pm->u.m[1][2];
poutscale->y=D3DXVec3Length(&vec);
vec.x=pm->m[2][0];
vec.y=pm->m[2][1];
vec.z=pm->m[2][2];
vec.x=pm->u.m[2][0];
vec.y=pm->u.m[2][1];
vec.z=pm->u.m[2][2];
poutscale->z=D3DXVec3Length(&vec);
/*Compute the translation part.*/
pouttranslation->x=pm->m[3][0];
pouttranslation->y=pm->m[3][1];
pouttranslation->z=pm->m[3][2];
pouttranslation->x=pm->u.m[3][0];
pouttranslation->y=pm->u.m[3][1];
pouttranslation->z=pm->u.m[3][2];
/*Let's calculate the rotation now*/
if ( (poutscale->x == 0.0f) || (poutscale->y == 0.0f) || (poutscale->z == 0.0f) )
......@@ -66,15 +68,15 @@ HRESULT WINAPI D3DXMatrixDecompose(D3DXVECTOR3 *poutscale, D3DXQUATERNION *poutr
return D3DERR_INVALIDCALL;
}
normalized.m[0][0]=pm->m[0][0]/poutscale->x;
normalized.m[0][1]=pm->m[0][1]/poutscale->x;
normalized.m[0][2]=pm->m[0][2]/poutscale->x;
normalized.m[1][0]=pm->m[1][0]/poutscale->y;
normalized.m[1][1]=pm->m[1][1]/poutscale->y;
normalized.m[1][2]=pm->m[1][2]/poutscale->y;
normalized.m[2][0]=pm->m[2][0]/poutscale->z;
normalized.m[2][1]=pm->m[2][1]/poutscale->z;
normalized.m[2][2]=pm->m[2][2]/poutscale->z;
normalized.u.m[0][0]=pm->u.m[0][0]/poutscale->x;
normalized.u.m[0][1]=pm->u.m[0][1]/poutscale->x;
normalized.u.m[0][2]=pm->u.m[0][2]/poutscale->x;
normalized.u.m[1][0]=pm->u.m[1][0]/poutscale->y;
normalized.u.m[1][1]=pm->u.m[1][1]/poutscale->y;
normalized.u.m[1][2]=pm->u.m[1][2]/poutscale->y;
normalized.u.m[2][0]=pm->u.m[2][0]/poutscale->z;
normalized.u.m[2][1]=pm->u.m[2][1]/poutscale->z;
normalized.u.m[2][2]=pm->u.m[2][2]/poutscale->z;
D3DXQuaternionRotationMatrix(poutrotation,&normalized);
return S_OK;
......
......@@ -97,22 +97,22 @@ static void test_Matrix_Decompose(void)
/*___________*/
pm.m[0][0] = -0.9238790f;
pm.m[1][0] = -0.2705984f;
pm.m[2][0] = 0.2705984f;
pm.m[3][0] = -5.0f;
pm.m[0][1] = 0.2705984f;
pm.m[1][1] = 0.03806049f;
pm.m[2][1] = 0.9619395f;
pm.m[3][1] = 0.0f;
pm.m[0][2] = -0.2705984f;
pm.m[1][2] = 0.9619395f;
pm.m[2][2] = 0.03806049f;
pm.m[3][2] = 10.0f;
pm.m[0][3] = 0.0f;
pm.m[1][3] = 0.0f;
pm.m[2][3] = 0.0f;
pm.m[3][3] = 1.0f;
U(pm).m[0][0] = -0.9238790f;
U(pm).m[1][0] = -0.2705984f;
U(pm).m[2][0] = 0.2705984f;
U(pm).m[3][0] = -5.0f;
U(pm).m[0][1] = 0.2705984f;
U(pm).m[1][1] = 0.03806049f;
U(pm).m[2][1] = 0.9619395f;
U(pm).m[3][1] = 0.0f;
U(pm).m[0][2] = -0.2705984f;
U(pm).m[1][2] = 0.9619395f;
U(pm).m[2][2] = 0.03806049f;
U(pm).m[3][2] = 10.0f;
U(pm).m[0][3] = 0.0f;
U(pm).m[1][3] = 0.0f;
U(pm).m[2][3] = 0.0f;
U(pm).m[3][3] = 1.0f;
exp_scale.x = 1.0f;
exp_scale.y = 1.0f;
......@@ -135,22 +135,22 @@ static void test_Matrix_Decompose(void)
/*_________*/
pm.m[0][0] = -2.255813f;
pm.m[1][0] = 1.302324f;
pm.m[2][0] = 1.488373f;
pm.m[3][0] = 1.0f;
pm.m[0][1] = 1.302327f;
pm.m[1][1] = -0.7209296f;
pm.m[2][1] = 2.60465f;
pm.m[3][1] = 2.0f;
pm.m[0][2] = 1.488371f;
pm.m[1][2] = 2.604651f;
pm.m[2][2] = -0.02325551f;
pm.m[3][2] = 3.0f;
pm.m[0][3] = 0.0f;
pm.m[1][3] = 0.0f;
pm.m[2][3] = 0.0f;
pm.m[3][3] = 1.0f;
U(pm).m[0][0] = -2.255813f;
U(pm).m[1][0] = 1.302324f;
U(pm).m[2][0] = 1.488373f;
U(pm).m[3][0] = 1.0f;
U(pm).m[0][1] = 1.302327f;
U(pm).m[1][1] = -0.7209296f;
U(pm).m[2][1] = 2.60465f;
U(pm).m[3][1] = 2.0f;
U(pm).m[0][2] = 1.488371f;
U(pm).m[1][2] = 2.604651f;
U(pm).m[2][2] = -0.02325551f;
U(pm).m[3][2] = 3.0f;
U(pm).m[0][3] = 0.0f;
U(pm).m[1][3] = 0.0f;
U(pm).m[2][3] = 0.0f;
U(pm).m[3][3] = 1.0f;
exp_scale.x = 3.0f;
exp_scale.y = 3.0f;
......@@ -173,22 +173,22 @@ static void test_Matrix_Decompose(void)
/*_____________*/
pm.m[0][0] = 2.427051f;
pm.m[1][0] = 0.0f;
pm.m[2][0] = 1.763355f;
pm.m[3][0] = 5.0f;
pm.m[0][1] = 0.0f;
pm.m[1][1] = 3.0f;
pm.m[2][1] = 0.0f;
pm.m[3][1] = 5.0f;
pm.m[0][2] = -1.763355f;
pm.m[1][2] = 0.0f;
pm.m[2][2] = 2.427051f;
pm.m[3][2] = 5.0f;
pm.m[0][3] = 0.0f;
pm.m[1][3] = 0.0f;
pm.m[2][3] = 0.0f;
pm.m[3][3] = 1.0f;
U(pm).m[0][0] = 2.427051f;
U(pm).m[1][0] = 0.0f;
U(pm).m[2][0] = 1.763355f;
U(pm).m[3][0] = 5.0f;
U(pm).m[0][1] = 0.0f;
U(pm).m[1][1] = 3.0f;
U(pm).m[2][1] = 0.0f;
U(pm).m[3][1] = 5.0f;
U(pm).m[0][2] = -1.763355f;
U(pm).m[1][2] = 0.0f;
U(pm).m[2][2] = 2.427051f;
U(pm).m[3][2] = 5.0f;
U(pm).m[0][3] = 0.0f;
U(pm).m[1][3] = 0.0f;
U(pm).m[2][3] = 0.0f;
U(pm).m[3][3] = 1.0f;
exp_scale.x = 3.0f;
exp_scale.y = 3.0f;
......@@ -211,22 +211,22 @@ static void test_Matrix_Decompose(void)
/*_____________*/
pm.m[0][0] = -0.9238790f;
pm.m[1][0] = -0.2705984f;
pm.m[2][0] = 0.2705984f;
pm.m[3][0] = -5.0f;
pm.m[0][1] = 0.2705984f;
pm.m[1][1] = 0.03806049f;
pm.m[2][1] = 0.9619395f;
pm.m[3][1] = 0.0f;
pm.m[0][2] = -0.2705984f;
pm.m[1][2] = 0.9619395f;
pm.m[2][2] = 0.03806049f;
pm.m[3][2] = 10.0f;
pm.m[0][3] = 0.0f;
pm.m[1][3] = 0.0f;
pm.m[2][3] = 0.0f;
pm.m[3][3] = 1.0f;
U(pm).m[0][0] = -0.9238790f;
U(pm).m[1][0] = -0.2705984f;
U(pm).m[2][0] = 0.2705984f;
U(pm).m[3][0] = -5.0f;
U(pm).m[0][1] = 0.2705984f;
U(pm).m[1][1] = 0.03806049f;
U(pm).m[2][1] = 0.9619395f;
U(pm).m[3][1] = 0.0f;
U(pm).m[0][2] = -0.2705984f;
U(pm).m[1][2] = 0.9619395f;
U(pm).m[2][2] = 0.03806049f;
U(pm).m[3][2] = 10.0f;
U(pm).m[0][3] = 0.0f;
U(pm).m[1][3] = 0.0f;
U(pm).m[2][3] = 0.0f;
U(pm).m[3][3] = 1.0f;
exp_scale.x = 1.0f;
exp_scale.y = 1.0f;
......@@ -249,22 +249,22 @@ static void test_Matrix_Decompose(void)
/*__________*/
pm.m[0][0] = -0.9238790f;
pm.m[1][0] = -0.5411968f;
pm.m[2][0] = 0.8117952f;
pm.m[3][0] = -5.0f;
pm.m[0][1] = 0.2705984f;
pm.m[1][1] = 0.07612098f;
pm.m[2][1] = 2.8858185f;
pm.m[3][1] = 0.0f;
pm.m[0][2] = -0.2705984f;
pm.m[1][2] = 1.9238790f;
pm.m[2][2] = 0.11418147f;
pm.m[3][2] = 10.0f;
pm.m[0][3] = 0.0f;
pm.m[1][3] = 0.0f;
pm.m[2][3] = 0.0f;
pm.m[3][3] = 1.0f;
U(pm).m[0][0] = -0.9238790f;
U(pm).m[1][0] = -0.5411968f;
U(pm).m[2][0] = 0.8117952f;
U(pm).m[3][0] = -5.0f;
U(pm).m[0][1] = 0.2705984f;
U(pm).m[1][1] = 0.07612098f;
U(pm).m[2][1] = 2.8858185f;
U(pm).m[3][1] = 0.0f;
U(pm).m[0][2] = -0.2705984f;
U(pm).m[1][2] = 1.9238790f;
U(pm).m[2][2] = 0.11418147f;
U(pm).m[3][2] = 10.0f;
U(pm).m[0][3] = 0.0f;
U(pm).m[1][3] = 0.0f;
U(pm).m[2][3] = 0.0f;
U(pm).m[3][3] = 1.0f;
exp_scale.x = 1.0f;
exp_scale.y = 2.0f;
......@@ -287,22 +287,22 @@ static void test_Matrix_Decompose(void)
/*__________*/
pm.m[0][0] = 0.7156004f;
pm.m[1][0] = -0.5098283f;
pm.m[2][0] = -0.4774843f;
pm.m[3][0] = -5.0f;
pm.m[0][1] = -0.6612288f;
pm.m[1][1] = -0.7147621f;
pm.m[2][1] = -0.2277977f;
pm.m[3][1] = 0.0f;
pm.m[0][2] = -0.2251499f;
pm.m[1][2] = 0.4787385f;
pm.m[2][2] = -0.8485972f;
pm.m[3][2] = 10.0f;
pm.m[0][3] = 0.0f;
pm.m[1][3] = 0.0f;
pm.m[2][3] = 0.0f;
pm.m[3][3] = 1.0f;
U(pm).m[0][0] = 0.7156004f;
U(pm).m[1][0] = -0.5098283f;
U(pm).m[2][0] = -0.4774843f;
U(pm).m[3][0] = -5.0f;
U(pm).m[0][1] = -0.6612288f;
U(pm).m[1][1] = -0.7147621f;
U(pm).m[2][1] = -0.2277977f;
U(pm).m[3][1] = 0.0f;
U(pm).m[0][2] = -0.2251499f;
U(pm).m[1][2] = 0.4787385f;
U(pm).m[2][2] = -0.8485972f;
U(pm).m[3][2] = 10.0f;
U(pm).m[0][3] = 0.0f;
U(pm).m[1][3] = 0.0f;
U(pm).m[2][3] = 0.0f;
U(pm).m[3][3] = 1.0f;
exp_scale.x = 1.0f;
exp_scale.y = 1.0f;
......@@ -325,22 +325,22 @@ static void test_Matrix_Decompose(void)
/*_____________*/
pm.m[0][0] = 0.06554436f;
pm.m[1][0] = -0.6873012f;
pm.m[2][0] = 0.7234092f;
pm.m[3][0] = -5.0f;
pm.m[0][1] = -0.9617381f;
pm.m[1][1] = -0.2367795f;
pm.m[2][1] = -0.1378230f;
pm.m[3][1] = 0.0f;
pm.m[0][2] = 0.2660144f;
pm.m[1][2] = -0.6866967f;
pm.m[2][2] = -0.6765233f;
pm.m[3][2] = 10.0f;
pm.m[0][3] = 0.0f;
pm.m[1][3] = 0.0f;
pm.m[2][3] = 0.0f;
pm.m[3][3] = 1.0f;
U(pm).m[0][0] = 0.06554436f;
U(pm).m[1][0] = -0.6873012f;
U(pm).m[2][0] = 0.7234092f;
U(pm).m[3][0] = -5.0f;
U(pm).m[0][1] = -0.9617381f;
U(pm).m[1][1] = -0.2367795f;
U(pm).m[2][1] = -0.1378230f;
U(pm).m[3][1] = 0.0f;
U(pm).m[0][2] = 0.2660144f;
U(pm).m[1][2] = -0.6866967f;
U(pm).m[2][2] = -0.6765233f;
U(pm).m[3][2] = 10.0f;
U(pm).m[0][3] = 0.0f;
U(pm).m[1][3] = 0.0f;
U(pm).m[2][3] = 0.0f;
U(pm).m[3][3] = 1.0f;
exp_scale.x = 1.0f;
exp_scale.y = 1.0f;
......@@ -363,22 +363,22 @@ static void test_Matrix_Decompose(void)
/*_________*/
pm.m[0][0] = 7.121047f;
pm.m[1][0] = -5.883487f;
pm.m[2][0] = 11.81843f;
pm.m[3][0] = -5.0f;
pm.m[0][1] = 5.883487f;
pm.m[1][1] = -10.60660f;
pm.m[2][1] = -8.825232f;
pm.m[3][1] = 0.0f;
pm.m[0][2] = 11.81843f;
pm.m[1][2] = 8.8252320f;
pm.m[2][2] = -2.727645f;
pm.m[3][2] = 2.0f;
pm.m[0][3] = 0.0f;
pm.m[1][3] = 0.0f;
pm.m[2][3] = 0.0f;
pm.m[3][3] = 1.0f;
U(pm).m[0][0] = 7.121047f;
U(pm).m[1][0] = -5.883487f;
U(pm).m[2][0] = 11.81843f;
U(pm).m[3][0] = -5.0f;
U(pm).m[0][1] = 5.883487f;
U(pm).m[1][1] = -10.60660f;
U(pm).m[2][1] = -8.825232f;
U(pm).m[3][1] = 0.0f;
U(pm).m[0][2] = 11.81843f;
U(pm).m[1][2] = 8.8252320f;
U(pm).m[2][2] = -2.727645f;
U(pm).m[3][2] = 2.0f;
U(pm).m[0][3] = 0.0f;
U(pm).m[1][3] = 0.0f;
U(pm).m[2][3] = 0.0f;
U(pm).m[3][3] = 1.0f;
exp_scale.x = 15.0f;
exp_scale.y = 15.0f;
......@@ -401,22 +401,22 @@ static void test_Matrix_Decompose(void)
/*__________*/
pm.m[0][0] = 0.0f;
pm.m[1][0] = 4.0f;
pm.m[2][0] = 5.0f;
pm.m[3][0] = -5.0f;
pm.m[0][1] = 0.0f;
pm.m[1][1] = -10.60660f;
pm.m[2][1] = -8.825232f;
pm.m[3][1] = 6.0f;
pm.m[0][2] = 0.0f;
pm.m[1][2] = 8.8252320f;
pm.m[2][2] = 2.727645;
pm.m[3][2] = 3.0f;
pm.m[0][3] = 0.0f;
pm.m[1][3] = 0.0f;
pm.m[2][3] = 0.0f;
pm.m[3][3] = 1.0f;
U(pm).m[0][0] = 0.0f;
U(pm).m[1][0] = 4.0f;
U(pm).m[2][0] = 5.0f;
U(pm).m[3][0] = -5.0f;
U(pm).m[0][1] = 0.0f;
U(pm).m[1][1] = -10.60660f;
U(pm).m[2][1] = -8.825232f;
U(pm).m[3][1] = 6.0f;
U(pm).m[0][2] = 0.0f;
U(pm).m[1][2] = 8.8252320f;
U(pm).m[2][2] = 2.727645;
U(pm).m[3][2] = 3.0f;
U(pm).m[0][3] = 0.0f;
U(pm).m[1][3] = 0.0f;
U(pm).m[2][3] = 0.0f;
U(pm).m[3][3] = 1.0f;
hr = D3DXMatrixDecompose(&got_scale, &got_rotation, &got_translation, &pm);
ok(hr == D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, got %x\n", hr);
......
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