From 708c4b244f08ce78a5e27ed262d7c1a0be5a64cc Mon Sep 17 00:00:00 2001 From: Lionel Ulmer Date: Sat, 30 Nov 2002 19:12:32 +0000 Subject: [PATCH] - fixed D3DFVF_VERTEX case - some other miscellaneous fixes --- dlls/ddraw/d3ddevice/mesa.c | 34 +++++++++++++++------------------- dlls/ddraw/d3dviewport.c | 4 ++-- dlls/ddraw/mesa_private.h | 32 ++++++++++++++++---------------- 3 files changed, 33 insertions(+), 37 deletions(-) diff --git a/dlls/ddraw/d3ddevice/mesa.c b/dlls/ddraw/d3ddevice/mesa.c index 2b5abedd3f1..90d814cfddb 100644 --- a/dlls/ddraw/d3ddevice/mesa.c +++ b/dlls/ddraw/d3ddevice/mesa.c @@ -579,23 +579,26 @@ GL_IDirect3DDeviceImpl_7_3T_2T_SetTransform(LPDIRECT3DDEVICE7 iface, switch (dtstTransformStateType) { case D3DTRANSFORMSTATE_WORLD: { + TRACE(" D3DTRANSFORMSTATE_WORLD :\n"); conv_mat(lpD3DMatrix, glThis->world_mat); glMatrixMode(GL_MODELVIEW); - glLoadMatrixf((float *) glThis->world_mat); + glLoadMatrixf((float *) glThis->view_mat); + glMultMatrixf((float *) glThis->world_mat); } break; case D3DTRANSFORMSTATE_VIEW: { + TRACE(" D3DTRANSFORMSTATE_VIEW :\n"); conv_mat(lpD3DMatrix, glThis->view_mat); - glMatrixMode(GL_PROJECTION); - glLoadMatrixf((float *) glThis->proj_mat); - glMultMatrixf((float *) glThis->view_mat); + glMatrixMode(GL_MODELVIEW); + glLoadMatrixf((float *) glThis->view_mat); + glMultMatrixf((float *) glThis->world_mat); } break; case D3DTRANSFORMSTATE_PROJECTION: { + TRACE(" D3DTRANSFORMSTATE_PROJECTION :\n"); conv_mat(lpD3DMatrix, glThis->proj_mat); glMatrixMode(GL_PROJECTION); glLoadMatrixf((float *) glThis->proj_mat); - glMultMatrixf((float *) glThis->view_mat); } break; default: @@ -656,13 +659,13 @@ inline static void draw_primitive(IDirect3DDeviceGLImpl *glThis, DWORD maxvert, if ((glThis->vertex_type == D3DVT_TLVERTEX) && (d3dvt != D3DVT_TLVERTEX)) { /* Need to put the correct transformation again if we go from Transformed / Lighted - vertices to non-transfromed ones. + vertices to non-transformed ones. */ glMatrixMode(GL_MODELVIEW); - glLoadMatrixf((float *) glThis->world_mat); + glLoadMatrixf((float *) glThis->view_mat); + glMultMatrixf((float *) glThis->world_mat); glMatrixMode(GL_PROJECTION); glLoadMatrixf((float *) glThis->proj_mat); - glMultMatrixf((float *) glThis->view_mat); } switch (d3dvt) { @@ -880,7 +883,6 @@ static void dump_flexible_vertex(DWORD d3dvtVertexType) typedef struct { float x, y, z; float nx, ny, nz; - DWORD dwDiffuseRGBA; float tu1, tv1; } D3DFVF_VERTEX_1; @@ -905,23 +907,17 @@ static void draw_primitive_7(IDirect3DDeviceImpl *This, D3DFVF_VERTEX_1 *vertices = (D3DFVF_VERTEX_1 *) lpvVertices; int index; + glEnable(GL_LIGHTING); + for (index = 0; index < dwIndexCount; index++) { int i = (dwIndices == NULL) ? index : dwIndices[index]; glNormal3f(vertices[i].nx, vertices[i].ny, vertices[i].nz); glTexCoord2f(vertices[i].tu1, vertices[i].tv1); - glColor4ub((vertices[i].dwDiffuseRGBA >> 24) & 0xFF, - (vertices[i].dwDiffuseRGBA >> 16) & 0xFF, - (vertices[i].dwDiffuseRGBA >> 8) & 0xFF, - (vertices[i].dwDiffuseRGBA >> 0) & 0xFF); glVertex3f(vertices[i].x, vertices[i].y, vertices[i].z); - TRACE(" %f %f %f / %f %f %f (%02lx %02lx %02lx %02lx) (%f %f)\n", + TRACE(" %f %f %f / %f %f %f (%f %f)\n", vertices[i].x, vertices[i].y, vertices[i].z, vertices[i].nx, vertices[i].ny, vertices[i].nz, - (vertices[i].dwDiffuseRGBA >> 24) & 0xFF, - (vertices[i].dwDiffuseRGBA >> 16) & 0xFF, - (vertices[i].dwDiffuseRGBA >> 8) & 0xFF, - (vertices[i].dwDiffuseRGBA >> 0) & 0xFF, vertices[i].tu1, vertices[i].tv1); } } @@ -1248,7 +1244,7 @@ static void d3ddevice_unlock_update(IDirectDrawSurfaceImpl* This, LPCRECT pRect) /* Application wants to lock the back buffer */ glDrawBuffer(GL_BACK); } else { - WARN(" do not support 3D surface locking for this surface type - trying to use default buffer.\n"); + WARN(" do not support 3D surface unlocking for this surface type - trying to use default buffer.\n"); } if (This->surface_desc.u4.ddpfPixelFormat.u1.dwRGBBitCount == 16) { diff --git a/dlls/ddraw/d3dviewport.c b/dlls/ddraw/d3dviewport.c index 12c38459aa9..2a036174593 100644 --- a/dlls/ddraw/d3dviewport.c +++ b/dlls/ddraw/d3dviewport.c @@ -141,7 +141,7 @@ Main_IDirect3DViewportImpl_3_2_1_GetViewport(LPDIRECT3DVIEWPORT3 iface, memcpy(lpData, &(This->viewports.vp1), dwSize); if (TRACE_ON(ddraw)) { - TRACE(" returning D3DVIEWPORT :"); + TRACE(" returning D3DVIEWPORT :\n"); _dump_D3DVIEWPORT(lpData); } @@ -308,7 +308,7 @@ Main_IDirect3DViewportImpl_3_2_GetViewport2(LPDIRECT3DVIEWPORT3 iface, memcpy(lpData, &(This->viewports.vp2), dwSize); if (TRACE_ON(ddraw)) { - TRACE(" returning D3DVIEWPORT2 :"); + TRACE(" returning D3DVIEWPORT2 :\n"); _dump_D3DVIEWPORT2(lpData); } diff --git a/dlls/ddraw/mesa_private.h b/dlls/ddraw/mesa_private.h index 2a0e4124698..de9325e601c 100644 --- a/dlls/ddraw/mesa_private.h +++ b/dlls/ddraw/mesa_private.h @@ -132,22 +132,22 @@ extern HRESULT d3ddevice_find(IDirect3DImpl *d3d, LPD3DFINDDEVICESEARCH lpD3DDFS TRACE("%f %f %f %f\n", (mat)->_21, (mat)->_22, (mat)->_23, (mat)->_24); \ TRACE("%f %f %f %f\n", (mat)->_31, (mat)->_32, (mat)->_33, (mat)->_34); \ TRACE("%f %f %f %f\n", (mat)->_41, (mat)->_42, (mat)->_43, (mat)->_44); \ - (gl_mat)[ 0] = (mat)->_11; \ - (gl_mat)[ 1] = (mat)->_21; \ - (gl_mat)[ 2] = (mat)->_31; \ - (gl_mat)[ 3] = (mat)->_41; \ - (gl_mat)[ 4] = (mat)->_12; \ - (gl_mat)[ 5] = (mat)->_22; \ - (gl_mat)[ 6] = (mat)->_32; \ - (gl_mat)[ 7] = (mat)->_42; \ - (gl_mat)[ 8] = (mat)->_13; \ - (gl_mat)[ 9] = (mat)->_23; \ - (gl_mat)[10] = (mat)->_33; \ - (gl_mat)[11] = (mat)->_43; \ - (gl_mat)[12] = (mat)->_14; \ - (gl_mat)[13] = (mat)->_24; \ - (gl_mat)[14] = (mat)->_34; \ - (gl_mat)[15] = (mat)->_44; \ + (gl_mat)->_11 = (mat)->_11; \ + (gl_mat)->_12 = (mat)->_21; \ + (gl_mat)->_13 = (mat)->_31; \ + (gl_mat)->_14 = (mat)->_41; \ + (gl_mat)->_21 = (mat)->_12; \ + (gl_mat)->_22 = (mat)->_22; \ + (gl_mat)->_23 = (mat)->_32; \ + (gl_mat)->_24 = (mat)->_42; \ + (gl_mat)->_31 = (mat)->_13; \ + (gl_mat)->_32 = (mat)->_23; \ + (gl_mat)->_33 = (mat)->_33; \ + (gl_mat)->_34 = (mat)->_43; \ + (gl_mat)->_41 = (mat)->_14; \ + (gl_mat)->_42 = (mat)->_24; \ + (gl_mat)->_43 = (mat)->_34; \ + (gl_mat)->_44 = (mat)->_44; \ }; /* Matrix copy WITHOUT transposition */