wined3d: Move WINED3DRS_AMBIENT to the state table.

This commit is contained in:
Stefan Dösinger 2006-12-08 01:45:26 +01:00 committed by Alexandre Julliard
parent 2ac48e8154
commit 28cc3c8d6b
2 changed files with 11 additions and 12 deletions

View File

@ -3444,18 +3444,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, W
case WINED3DRS_DITHERENABLE :
case WINED3DRS_ZWRITEENABLE :
case WINED3DRS_ZFUNC :
StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
break;
case WINED3DRS_AMBIENT :
{
float col[4];
D3DCOLORTOGLFLOAT4(Value, col);
TRACE("Setting ambient to (%f,%f,%f,%f)\n", col[0], col[1], col[2], col[3]);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, col);
checkGLcall("glLightModel for MODEL_AMBIENT");
}
StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
break;
case WINED3DRS_ALPHABLENDENABLE :

View File

@ -204,6 +204,15 @@ static void state_zfunc(DWORD state, IWineD3DStateBlockImpl *stateblock) {
}
}
static void state_ambient(DWORD state, IWineD3DStateBlockImpl *stateblock) {
float col[4];
D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_AMBIENT], col);
TRACE("Setting ambient to (%f,%f,%f,%f)\n", col[0], col[1], col[2], col[3]);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, col);
checkGLcall("glLightModel for MODEL_AMBIENT");
}
const struct StateEntry StateTable[] =
{
/* State name representative, apply function */
@ -348,7 +357,7 @@ const struct StateEntry StateTable[] =
{ /*136, WINED3DRS_CLIPPING */ STATE_RENDER(WINED3DRS_CLIPPING), state_unknown },
{ /*137, WINED3DRS_LIGHTING */ STATE_RENDER(WINED3DRS_LIGHTING) /* Vertex decl! */,state_lighting },
{ /*138, WINED3DRS_EXTENTS */ STATE_RENDER(WINED3DRS_EXTENTS), state_unknown },
{ /*139, WINED3DRS_AMBIENT */ STATE_RENDER(WINED3DRS_AMBIENT), state_unknown },
{ /*139, WINED3DRS_AMBIENT */ STATE_RENDER(WINED3DRS_AMBIENT), state_ambient },
{ /*140, WINED3DRS_FOGVERTEXMODE */ STATE_RENDER(WINED3DRS_FOGENABLE), state_unknown },
{ /*141, WINED3DRS_COLORVERTEX */ STATE_RENDER(WINED3DRS_COLORVERTEX), state_unknown },
{ /*142, WINED3DRS_LOCALVIEWER */ STATE_RENDER(WINED3DRS_LOCALVIEWER), state_unknown },