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

wined3d: Use 0/0/0 as normal if no normal is supplied.

parent af66d215
...@@ -350,7 +350,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData ...@@ -350,7 +350,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
/* Default settings for data that is not passed */ /* Default settings for data that is not passed */
if (sd->u.s.normal.lpData == NULL) { if (sd->u.s.normal.lpData == NULL) {
glNormal3f(0, 0, 1); glNormal3f(0, 0, 0);
} }
if(sd->u.s.diffuse.lpData == NULL) { if(sd->u.s.diffuse.lpData == NULL) {
glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
......
...@@ -1196,7 +1196,16 @@ static void state_zbias(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D ...@@ -1196,7 +1196,16 @@ static void state_zbias(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
static void state_normalize(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) { static void state_normalize(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
if (stateblock->renderState[WINED3DRS_NORMALIZENORMALS]) { if(isStateDirty(context, STATE_VDECL)) {
return;
}
/* Without vertex normals, we set the current normal to 0/0/0 to remove the diffuse factor
* from the opengl lighting equation, as d3d does. Normalization of 0/0/0 can lead to a division
* by zero and is not properly defined in opengl, so avoid it
*/
if (stateblock->renderState[WINED3DRS_NORMALIZENORMALS] && (
stateblock->wineD3DDevice->strided_streams.u.s.normal.lpData ||
stateblock->wineD3DDevice->strided_streams.u.s.normal.VBO)) {
glEnable(GL_NORMALIZE); glEnable(GL_NORMALIZE);
checkGLcall("glEnable(GL_NORMALIZE);"); checkGLcall("glEnable(GL_NORMALIZE);");
} else { } else {
...@@ -3031,8 +3040,8 @@ static void loadVertexData(IWineD3DStateBlockImpl *stateblock, WineDirect3DVerte ...@@ -3031,8 +3040,8 @@ static void loadVertexData(IWineD3DStateBlockImpl *stateblock, WineDirect3DVerte
checkGLcall("glEnableClientState(GL_NORMAL_ARRAY)"); checkGLcall("glEnableClientState(GL_NORMAL_ARRAY)");
} else { } else {
glNormal3f(0, 0, 1); glNormal3f(0, 0, 0);
checkGLcall("glNormal3f(0, 0, 1)"); checkGLcall("glNormal3f(0, 0, 0)");
} }
/* Diffuse Colour --------------------------------------------*/ /* Diffuse Colour --------------------------------------------*/
...@@ -3307,6 +3316,9 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W ...@@ -3307,6 +3316,9 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W
if(context->last_was_vshader && !isStateDirty(context, STATE_RENDER(WINED3DRS_CLIPPLANEENABLE))) { if(context->last_was_vshader && !isStateDirty(context, STATE_RENDER(WINED3DRS_CLIPPLANEENABLE))) {
state_clipping(STATE_RENDER(WINED3DRS_CLIPPLANEENABLE), stateblock, context); state_clipping(STATE_RENDER(WINED3DRS_CLIPPLANEENABLE), stateblock, context);
} }
if(!isStateDirty(context, STATE_RENDER(WINED3DRS_NORMALIZENORMALS))) {
state_normalize(STATE_RENDER(WINED3DRS_NORMALIZENORMALS), stateblock, context);
}
} else { } else {
/* We compile the shader here because we need the vertex declaration /* We compile the shader here because we need the vertex declaration
* in order to determine if we need to do any swizzling for D3DCOLOR * in order to determine if we need to do any swizzling for D3DCOLOR
......
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