Stefan Dösinger : wined3d: Move WINED3DTS_MODELVIEW to the state table.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Jan 2 06:45:56 CST 2007
Module: wine
Branch: master
Commit: f5fafab663f8cb28a70a8f35d3f5c353f5378c16
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f5fafab663f8cb28a70a8f35d3f5c353f5378c16
Author: Stefan Dösinger <stefandoesinger at gmx.at>
Date: Tue Jan 2 00:48:58 2007 +0100
wined3d: Move WINED3DTS_MODELVIEW to the state table.
---
dlls/wined3d/device.c | 41 ++---------------------------------------
dlls/wined3d/state.c | 40 +++++++++++++++++++++++++++++++++++++++-
2 files changed, 41 insertions(+), 40 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 38afc4f..0c2a180 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2372,53 +2372,16 @@ static HRESULT WINAPI IWineD3DDeviceIm
return WINED3D_OK;
}
- /* Now we really are going to have to change a matrix */
- ENTER_GL();
-
if (d3dts >= WINED3DTS_TEXTURE0 && d3dts <= WINED3DTS_TEXTURE7) { /* handle texture matrices */
/* This is now set with the texture unit states, it may be a good idea to flag the change though! */
} else if (d3dts == WINED3DTS_VIEW) { /* handle the VIEW matrice */
- unsigned int k;
-
- /* If we are changing the View matrix, reset the light and clipping planes to the new view
- * NOTE: We have to reset the positions even if the light/plane is not currently
- * enabled, since the call to enable it will not reset the position.
- * NOTE2: Apparently texture transforms do NOT need reapplying
- */
-
- PLIGHTINFOEL *lightChain = NULL;
- This->modelview_valid = FALSE;
This->view_ident = !memcmp(lpmatrix, identity, 16 * sizeof(float));
-
- glMatrixMode(GL_MODELVIEW);
- checkGLcall("glMatrixMode(GL_MODELVIEW)");
- glPushMatrix();
- glLoadMatrixf((const float *)lpmatrix);
- checkGLcall("glLoadMatrixf(...)");
-
- /* Reset lights */
- lightChain = This->stateBlock->lights;
- while (lightChain && lightChain->glIndex != -1) {
- glLightfv(GL_LIGHT0 + lightChain->glIndex, GL_POSITION, lightChain->lightPosn);
- checkGLcall("glLightfv posn");
- glLightfv(GL_LIGHT0 + lightChain->glIndex, GL_SPOT_DIRECTION, lightChain->lightDirn);
- checkGLcall("glLightfv dirn");
- lightChain = lightChain->next;
- }
-
- /* Reset Clipping Planes if clipping is enabled */
- for (k = 0; k < GL_LIMITS(clipplanes); k++) {
- glClipPlane(GL_CLIP_PLANE0 + k, This->stateBlock->clipplane[k]);
- checkGLcall("glClipPlane");
- }
- glPopMatrix();
-
+ /* Handled by the state manager */
} else { /* What was requested!?? */
WARN("invalid matrix specified: %i\n", d3dts);
}
- /* Release lock, all done */
- LEAVE_GL();
+ IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TRANSFORM(d3dts));
return WINED3D_OK;
}
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 5a79d22..ed50a87 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -1805,6 +1805,44 @@ static void pixelshader(DWORD state, IWi
}
}
+static void transform_view(DWORD state, IWineD3DStateBlockImpl *stateblock) {
+ unsigned int k;
+
+ /* If we are changing the View matrix, reset the light and clipping planes to the new view
+ * NOTE: We have to reset the positions even if the light/plane is not currently
+ * enabled, since the call to enable it will not reset the position.
+ * NOTE2: Apparently texture transforms do NOT need reapplying
+ */
+
+ PLIGHTINFOEL *lightChain = NULL;
+ stateblock->wineD3DDevice->modelview_valid = FALSE;
+
+ glMatrixMode(GL_MODELVIEW);
+ checkGLcall("glMatrixMode(GL_MODELVIEW)");
+ glPushMatrix();
+ checkGLcall("glPushMatrix()");
+ glLoadMatrixf((float *)(float *) &stateblock->transforms[WINED3DTS_VIEW].u.m[0][0]);
+ checkGLcall("glLoadMatrixf(...)");
+
+ /* Reset lights. TODO: Call light apply func */
+ lightChain = stateblock->lights;
+ while (lightChain && lightChain->glIndex != -1) {
+ glLightfv(GL_LIGHT0 + lightChain->glIndex, GL_POSITION, lightChain->lightPosn);
+ checkGLcall("glLightfv posn");
+ glLightfv(GL_LIGHT0 + lightChain->glIndex, GL_SPOT_DIRECTION, lightChain->lightDirn);
+ checkGLcall("glLightfv dirn");
+ lightChain = lightChain->next;
+ }
+
+ /* Reset Clipping Planes if clipping is enabled. TODO: Call clipplane apply func */
+ for (k = 0; k < GL_LIMITS(clipplanes); k++) {
+ glClipPlane(GL_CLIP_PLANE0 + k, stateblock->clipplane[k]);
+ checkGLcall("glClipPlane");
+ }
+ glPopMatrix();
+ checkGLcall("glPopMatrix()");
+}
+
const struct StateEntry StateTable[] =
{
/* State name representative, apply function */
@@ -2306,7 +2344,7 @@ const struct StateEntry StateTable[] =
{ /* , Pixel Shader */ STATE_PIXELSHADER, pixelshader },
/* Transform states follow */
{ /* 1, undefined */ 0, state_undefined },
- { /* 2, WINED3DTS_VIEW */ STATE_TRANSFORM(WINED3DTS_VIEW), state_undefined },
+ { /* 2, WINED3DTS_VIEW */ STATE_TRANSFORM(WINED3DTS_VIEW), transform_view },
{ /* 3, WINED3DTS_PROJECTION */ STATE_TRANSFORM(WINED3DTS_PROJECTION), state_undefined },
{ /* 4, undefined */ 0, state_undefined },
{ /* 5, undefined */ 0, state_undefined },
More information about the wine-cvs
mailing list