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

wined3d: Do not reset the material.

parent 2520e387
...@@ -93,8 +93,6 @@ static DWORD primitiveToGl(WINED3DPRIMITIVETYPE PrimitiveType, ...@@ -93,8 +93,6 @@ static DWORD primitiveToGl(WINED3DPRIMITIVETYPE PrimitiveType,
/* Ensure the appropriate material states are set up - only change /* Ensure the appropriate material states are set up - only change
state if really required */ state if really required */
static void init_materials(IWineD3DDevice *iface, BOOL isDiffuseSupplied) { static void init_materials(IWineD3DDevice *iface, BOOL isDiffuseSupplied) {
BOOL requires_material_reset = FALSE;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
if (This->tracking_color == NEEDS_TRACKING && isDiffuseSupplied) { if (This->tracking_color == NEEDS_TRACKING && isDiffuseSupplied) {
...@@ -107,45 +105,19 @@ static void init_materials(IWineD3DDevice *iface, BOOL isDiffuseSupplied) { ...@@ -107,45 +105,19 @@ static void init_materials(IWineD3DDevice *iface, BOOL isDiffuseSupplied) {
glEnable(GL_COLOR_MATERIAL); glEnable(GL_COLOR_MATERIAL);
checkGLcall("glEnable GL_COLOR_MATERIAL"); checkGLcall("glEnable GL_COLOR_MATERIAL");
This->tracking_color = IS_TRACKING; This->tracking_color = IS_TRACKING;
requires_material_reset = TRUE; /* Restore material settings as will be used */
} else if ((This->tracking_color == IS_TRACKING && !isDiffuseSupplied) || } else if ((This->tracking_color == IS_TRACKING && !isDiffuseSupplied) ||
(This->tracking_color == NEEDS_TRACKING && !isDiffuseSupplied)) { (This->tracking_color == NEEDS_TRACKING && !isDiffuseSupplied)) {
/* If we are tracking the current color but one isn't supplied, don't! */ /* If we are tracking the current color but one isn't supplied, don't! */
glDisable(GL_COLOR_MATERIAL); glDisable(GL_COLOR_MATERIAL);
checkGLcall("glDisable GL_COLOR_MATERIAL"); checkGLcall("glDisable GL_COLOR_MATERIAL");
This->tracking_color = NEEDS_TRACKING; This->tracking_color = NEEDS_TRACKING;
requires_material_reset = TRUE; /* Restore material settings as will be used */
} else if (This->tracking_color == IS_TRACKING && isDiffuseSupplied) { } else if (This->tracking_color == IS_TRACKING && isDiffuseSupplied) {
/* No need to reset material colors since no change to gl_color_material */ /* No need to reset material colors since no change to gl_color_material */
requires_material_reset = FALSE;
} else if (This->tracking_color == NEEDS_DISABLE) { } else if (This->tracking_color == NEEDS_DISABLE) {
glDisable(GL_COLOR_MATERIAL); glDisable(GL_COLOR_MATERIAL);
checkGLcall("glDisable GL_COLOR_MATERIAL"); checkGLcall("glDisable GL_COLOR_MATERIAL");
This->tracking_color = DISABLED_TRACKING; This->tracking_color = DISABLED_TRACKING;
requires_material_reset = TRUE; /* Restore material settings as will be used */
} }
/* Reset the material colors which may have been tracking the color*/
if (requires_material_reset) {
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float*) &This->stateBlock->material.Ambient);
checkGLcall("glMaterialfv");
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float*) &This->stateBlock->material.Diffuse);
checkGLcall("glMaterialfv");
if (This->stateBlock->renderState[WINED3DRS_SPECULARENABLE]) {
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) &This->stateBlock->material.Specular);
checkGLcall("glMaterialfv");
} else {
float black[4] = {0.0f, 0.0f, 0.0f, 0.0f};
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &black[0]);
checkGLcall("glMaterialfv");
}
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, (float*) &This->stateBlock->material.Emissive);
checkGLcall("glMaterialfv");
}
} }
static const GLfloat invymat[16] = { static const GLfloat invymat[16] = {
......
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