Minor fixes - Remove light debug statements, handle disabled specular

material properly, release surfaces when debugging and clean up trace
a little.
This commit is contained in:
Jason Edmeades 2003-10-03 03:35:53 +00:00 committed by Alexandre Julliard
parent 9bb19ac2d2
commit 06fd1e25f7
2 changed files with 15 additions and 7 deletions

View File

@ -1659,6 +1659,10 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetMaterial(LPDIRECT3DDEVICE8 iface, CONST
if (This->StateBlock->renderstate[D3DRS_SPECULARENABLE]) { if (This->StateBlock->renderstate[D3DRS_SPECULARENABLE]) {
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) &This->UpdateStateBlock->material.Specular); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) &This->UpdateStateBlock->material.Specular);
checkGLcall("glMaterialfv"); 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->UpdateStateBlock->material.Emissive); glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, (float*) &This->UpdateStateBlock->material.Emissive);
checkGLcall("glMaterialfv"); checkGLcall("glMaterialfv");
@ -1829,8 +1833,6 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetLight(LPDIRECT3DDEVICE8 iface, DWORD In
if (object->glIndex != -1) { if (object->glIndex != -1) {
setup_light(iface, object->glIndex, object); setup_light(iface, object->glIndex, object);
} }
DUMP_LIGHT_CHAIN();
return D3D_OK; return D3D_OK;
} }
HRESULT WINAPI IDirect3DDevice8Impl_GetLight(LPDIRECT3DDEVICE8 iface, DWORD Index,D3DLIGHT8* pLight) { HRESULT WINAPI IDirect3DDevice8Impl_GetLight(LPDIRECT3DDEVICE8 iface, DWORD Index,D3DLIGHT8* pLight) {
@ -1886,7 +1888,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_LightEnable(LPDIRECT3DDEVICE8 iface, DWORD
D3DLIGHT8 lightParms; D3DLIGHT8 lightParms;
/* Warning - untested code :-) Prob safe to change fixme to a trace but /* Warning - untested code :-) Prob safe to change fixme to a trace but
wait until someone confirms it seems to work! */ wait until someone confirms it seems to work! */
FIXME("Light enabled requested but light not defined, so defining one!\n"); TRACE("Light enabled requested but light not defined, so defining one!\n");
lightParms.Type = D3DLIGHT_DIRECTIONAL; lightParms.Type = D3DLIGHT_DIRECTIONAL;
lightParms.Diffuse.r = 1.0; lightParms.Diffuse.r = 1.0;
lightParms.Diffuse.g = 1.0; lightParms.Diffuse.g = 1.0;
@ -2074,7 +2076,6 @@ HRESULT WINAPI IDirect3DDevice8Impl_LightEnable(LPDIRECT3DDEVICE8 iface, DWORD
} }
} }
} }
DUMP_LIGHT_CHAIN();
return D3D_OK; return D3D_OK;
} }
HRESULT WINAPI IDirect3DDevice8Impl_GetLightEnable(LPDIRECT3DDEVICE8 iface, DWORD Index,BOOL* pEnable) { HRESULT WINAPI IDirect3DDevice8Impl_GetLightEnable(LPDIRECT3DDEVICE8 iface, DWORD Index,BOOL* pEnable) {

View File

@ -203,8 +203,14 @@ void init_materials(LPDIRECT3DDEVICE8 iface, BOOL isDiffuseSupplied) {
checkGLcall("glMaterialfv"); checkGLcall("glMaterialfv");
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float*) &This->StateBlock->material.Diffuse); glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float*) &This->StateBlock->material.Diffuse);
checkGLcall("glMaterialfv"); checkGLcall("glMaterialfv");
if (This->StateBlock->renderstate[D3DRS_SPECULARENABLE]) {
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) &This->StateBlock->material.Specular); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) &This->StateBlock->material.Specular);
checkGLcall("glMaterialfv"); 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); glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, (float*) &This->StateBlock->material.Emissive);
checkGLcall("glMaterialfv"); checkGLcall("glMaterialfv");
} }
@ -1478,9 +1484,10 @@ void drawPrimitive(LPDIRECT3DDEVICE8 iface,
for (textureNo = 0; textureNo < GL_LIMITS(textures); ++textureNo) { for (textureNo = 0; textureNo < GL_LIMITS(textures); ++textureNo) {
if (This->StateBlock->textures[textureNo] != NULL) { if (This->StateBlock->textures[textureNo] != NULL) {
sprintf(buffer, "/tmp/texture_%ld_%d.ppm", primCounter, textureNo); sprintf(buffer, "/tmp/texture_%ld_%d.ppm", primCounter, textureNo);
TRACE("Saving texture %s\n", buffer); TRACE("Saving texture %s (Format:%s)\n", buffer, debug_d3dformat(((IDirect3DBaseTexture8Impl *)This->StateBlock->textures[textureNo])->format));
IDirect3DTexture8Impl_GetSurfaceLevel((LPDIRECT3DTEXTURE8) This->StateBlock->textures[textureNo], 0, &pSur); IDirect3DTexture8Impl_GetSurfaceLevel((LPDIRECT3DTEXTURE8) This->StateBlock->textures[textureNo], 0, &pSur);
IDirect3DSurface8Impl_SaveSnapshot(pSur, buffer); IDirect3DSurface8Impl_SaveSnapshot(pSur, buffer);
IDirect3DSurface8Impl_ReleaseRef(pSur);
} }
} }
} }