Commit ce7fa156 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

ddraw: Store d3d1 projection matrices in device->legacy_projection.

The math in transform_vertex is now the same as in wined3d's process_vertices_strided. Calling wined3d_device_process_vertices is easier now, but that will require moving the vertex and index data into buffers. Signed-off-by: 's avatarStefan Dösinger <stefandoesinger@gmx.at> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent f660a563
......@@ -56,10 +56,11 @@ static void transform_vertex(D3DTLVERTEX *dst, const D3DMATRIX *mat,
dst->u3.sz = (x * mat->_13) + (y * mat->_23) + (z * mat->_33) + mat->_43;
dst->u4.rhw = (x * mat->_14) + (y * mat->_24) + (z * mat->_34) + mat->_44;
dst->u1.sx = dst->u1.sx / dst->u4.rhw * vp->dvScaleX + vp->dwX + vp->dwWidth / 2;
dst->u2.sy = -dst->u2.sy / dst->u4.rhw * vp->dvScaleY + vp->dwY + vp->dwHeight / 2;
dst->u3.sz /= dst->u4.rhw;
dst->u4.rhw = 1.0f / dst->u4.rhw;
dst->u1.sx = (dst->u1.sx * dst->u4.rhw + 1.0f) * vp->dwWidth * 0.5 + vp->dwX;
dst->u2.sy = (-dst->u2.sy * dst->u4.rhw + 1.0f) * vp->dwHeight * 0.5 + vp->dwY;
dst->u3.sz *= dst->u4.rhw;
}
HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
......@@ -203,7 +204,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
device->view = ci->u2.dwArg[0];
if (ci->u1.dtstTransformStateType == D3DTRANSFORMSTATE_PROJECTION)
device->proj = ci->u2.dwArg[0];
IDirect3DDevice7_SetTransform(&device->IDirect3DDevice7_iface,
IDirect3DDevice3_SetTransform(&device->IDirect3DDevice3_iface,
ci->u1.dtstTransformStateType, m);
}
......@@ -247,8 +248,8 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
TRACE("PROCESSVERTICES (%d)\n", count);
/* Get the transform and world matrix */
/* Note: D3DMATRIX is compatible with struct wined3d_matrix. */
/* Note that the projection set in wined3d has the legacy clip space
* adjustment built in. */
wined3d_device_get_transform(device->wined3d_device,
D3DTRANSFORMSTATE_VIEW, (struct wined3d_matrix *)&view_mat);
wined3d_device_get_transform(device->wined3d_device,
......
......@@ -9552,7 +9552,7 @@ static void test_transform_vertices(void)
{143.0f, 118.0f, 1.0f, 1.0f}, {133.0f, 128.0f, -1.0f, 1.0f}, {133.0f, 128.0f, 0.0f, 1.0f}
};
todo_wine ok(compare_vec4(&cmp[i], out[i].x, out[i].y, out[i].z, out[i].w, 4096),
ok(compare_vec4(&cmp[i], out[i].x, out[i].y, out[i].z, out[i].w, 4096),
"Vertex %u differs. Got %f %f %f %f.\n", i,
out[i].x, out[i].y, out[i].z, out[i].w);
}
......@@ -9657,10 +9657,10 @@ static void test_transform_vertices(void)
color = get_surface_color(rt, 128, 147);
ok(compare_color(color, 0x000000ff, 1), "Got unexpected color 0x%08x.\n", color);
color = get_surface_color(rt, 132, 147);
todo_wine ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
color = get_surface_color(rt, 177, 217);
todo_wine ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
color = get_surface_color(rt, 181, 217);
ok(compare_color(color, 0x000000ff, 1), "Got unexpected color 0x%08x.\n", color);
color = get_surface_color(rt, 177, 221);
......
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