Commit 9031adfd authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw/tests: Properly declare matrices.

parent b9bfcf2c
......@@ -2807,27 +2807,32 @@ static void SetMaterialTest(void)
static void ComputeSphereVisibility(void)
{
D3DMATRIX proj, view, world;
D3DMATRIX proj =
{
1.810660f, 0.000000f, 0.000000f, 0.000000f,
0.000000f, 2.414213f, 0.000000f, 0.000000f,
0.000000f, 0.000000f, 1.020408f, 1.000000f,
0.000000f, 0.000000f, -0.102041f, 0.000000f,
};
D3DMATRIX view =
{
1.000000f, 0.000000f, 0.000000f, 0.000000f,
0.000000f, 0.768221f, -0.640185f, 0.000000f,
-0.000000f, 0.640185f, 0.768221f, 0.000000f,
-14.852037f, 9.857489f, 11.600972f, 1.000000f,
};
D3DMATRIX world =
{
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f,
};
D3DVALUE radius[3];
D3DVECTOR center[3];
DWORD result[3];
HRESULT rc;
world._11=1.0; world._12=0.0; world._13=0.0; world._14=0.0;
world._21=0.0; world._22=1.0; world._23=0.0; world._24=0.0;
world._31=0.0; world._32=0.0; world._33=1.0; world._34=0.0;
world._41=0.0; world._42=0.0; world._43=0.0; world._44=1.0;
view._11=1.000000; view._12=0.000000; view._13=0.000000; view._14=0.000000;
view._21=0.000000; view._22=0.768221; view._23=-0.640185; view._24=0.000000;
view._31=-0.000000; view._32=0.640185; view._33=0.768221; view._34=0.000000;
view._41=-14.852037; view._42=9.857489; view._43=11.600972; view._44=1.000000;
proj._11=1.810660; proj._12=0.000000; proj._13=0.00000; proj._14=0.000000;
proj._21=0.000000; proj._22=2.414213; proj._23=0.000000, proj._24=0.000000;
proj._31=0.000000; proj._32=0.000000; proj._33=1.020408, proj._34=1.000000;
proj._41=0.000000; proj._42=0.000000; proj._43=-0.102041; proj._44=0.000000;
IDirect3DDevice7_SetTransform(lpD3DDevice, D3DTRANSFORMSTATE_WORLD, &world);
IDirect3DDevice7_SetTransform(lpD3DDevice, D3DTRANSFORMSTATE_VIEW , &view);
IDirect3DDevice7_SetTransform(lpD3DDevice, D3DTRANSFORMSTATE_PROJECTION, &proj);
......
......@@ -290,11 +290,13 @@ static void lighting_test(IDirect3DDevice7 *device)
DWORD nfvf = D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_NORMAL;
DWORD color;
float mat[16] = { 1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f };
D3DMATRIX mat =
{
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f,
};
struct vertex unlitquad[] =
{
{-1.0f, -1.0f, 0.1f, 0xffff0000},
......@@ -329,11 +331,11 @@ static void lighting_test(IDirect3DDevice7 *device)
ok(hr == D3D_OK, "IDirect3DDevice7_Clear failed with %08x\n", hr);
/* Setup some states that may cause issues */
hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_WORLD, (D3DMATRIX *) mat);
hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_WORLD, &mat);
ok(hr == D3D_OK, "IDirect3DDevice7_SetTransform returned %08x\n", hr);
hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_VIEW, (D3DMATRIX *)mat);
hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_VIEW, &mat);
ok(hr == D3D_OK, "IDirect3DDevice7_SetTransform returned %08x\n", hr);
hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, (D3DMATRIX *) mat);
hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &mat);
ok(hr == D3D_OK, "IDirect3DDevice7_SetTransform returned %08x\n", hr);
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_CLIPPING, FALSE);
ok(hr == D3D_OK, "IDirect3DDevice7_SetRenderState returned %08x\n", hr);
......@@ -491,36 +493,34 @@ static void fog_test(IDirect3DDevice7 *device)
{320, 480, 1.0f, 1.0f, 0xFFFFFF00, 0xFF000000 },
};
WORD Indices[] = {0, 1, 2, 2, 3, 0};
float ident_mat[16] =
D3DMATRIX ident_mat =
{
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
0.0f, 0.0f, 0.0f, 1.0f,
};
float world_mat1[16] =
D3DMATRIX world_mat1 =
{
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, -0.5f, 1.0f
0.0f, 0.0f, -0.5f, 1.0f,
};
float world_mat2[16] =
D3DMATRIX world_mat2 =
{
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 1.0f, 1.0f
0.0f, 0.0f, 1.0f, 1.0f,
};
float proj_mat[16] =
D3DMATRIX proj_mat =
{
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, -1.0f, 1.0f
0.0f, 0.0f, -1.0f, 1.0f,
};
struct sVertex far_quad1[] =
{
{-1.0f, -1.0f, 0.5f, 0xffff0000, 0xff000000},
......@@ -625,7 +625,7 @@ static void fog_test(IDirect3DDevice7 *device)
if (caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGTABLE)
{
/* A simple fog + non-identity world matrix test */
hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_WORLD, (D3DMATRIX *)world_mat1);
hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_WORLD, &world_mat1);
ok(hr == D3D_OK, "IDirect3DDevice7_SetTransform returned %#08x\n", hr);
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGTABLEMODE, D3DFOG_LINEAR);
......@@ -660,9 +660,9 @@ static void fog_test(IDirect3DDevice7 *device)
ok(color_match(color, 0x0000ff00, 1), "Fogged out quad has color %08x\n", color);
/* Test fog behavior with an orthogonal (but not identity) projection matrix */
hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_WORLD, (D3DMATRIX *)world_mat2);
hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_WORLD, &world_mat2);
ok(hr == D3D_OK, "SetTransform returned %#08x\n", hr);
hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, (D3DMATRIX *)proj_mat);
hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &proj_mat);
ok(hr == D3D_OK, "SetTransform returned %#08x\n", hr);
hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff00ff, 0.0, 0);
......@@ -691,9 +691,9 @@ static void fog_test(IDirect3DDevice7 *device)
color = getPixelColor(device, 160, 120);
ok(color_match(color, 0x0000ff00, 1), "Fogged out quad has color %08x\n", color);
hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_WORLD, (D3DMATRIX *)ident_mat);
hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_WORLD, &ident_mat);
ok(hr == D3D_OK, "SetTransform returned %#08x\n", hr);
hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, (D3DMATRIX *)ident_mat);
hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &ident_mat);
ok(hr == D3D_OK, "SetTransform returned %#08x\n", hr);
}
else
......@@ -2230,10 +2230,13 @@ static void D3D3_ViewportClearTest(void)
D3DVIEWPORT2 vp_data;
DWORD color, red, green, blue;
D3DRECT rect;
float mat[16] = { 1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f };
D3DMATRIX mat =
{
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f,
};
struct vertex quad[] =
{
{-1.0f, -1.0f, 0.1f, 0xffffffff},
......@@ -2335,11 +2338,11 @@ static void D3D3_ViewportClearTest(void)
hr = IDirect3DDevice3_BeginScene(Direct3DDevice3);
ok(hr == D3D_OK, "IDirect3DDevice3_BeginScene failed with %08x\n", hr);
hr = IDirect3DDevice3_SetTransform(Direct3DDevice3, D3DTRANSFORMSTATE_WORLD, (D3DMATRIX *) mat);
hr = IDirect3DDevice3_SetTransform(Direct3DDevice3, D3DTRANSFORMSTATE_WORLD, &mat);
ok(hr == D3D_OK, "IDirect3DDevice3_SetTransform returned %08x\n", hr);
hr = IDirect3DDevice3_SetTransform(Direct3DDevice3, D3DTRANSFORMSTATE_VIEW, (D3DMATRIX *)mat);
hr = IDirect3DDevice3_SetTransform(Direct3DDevice3, D3DTRANSFORMSTATE_VIEW, &mat);
ok(hr == D3D_OK, "IDirect3DDevice3_SetTransform returned %08x\n", hr);
hr = IDirect3DDevice3_SetTransform(Direct3DDevice3, D3DTRANSFORMSTATE_PROJECTION, (D3DMATRIX *) mat);
hr = IDirect3DDevice3_SetTransform(Direct3DDevice3, D3DTRANSFORMSTATE_PROJECTION, &mat);
ok(hr == D3D_OK, "IDirect3DDevice3_SetTransform returned %08x\n", hr);
hr = IDirect3DDevice3_SetRenderState(Direct3DDevice3, D3DRENDERSTATE_CLIPPING, FALSE);
ok(hr == D3D_OK, "IDirect3DDevice3_SetRenderState returned %08x\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