mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
wined3d: Clamp material power to 128.0.
This commit is contained in:
parent
c2cf60fcee
commit
4f8eb6a32e
@ -172,6 +172,7 @@ static void LightTest(void)
|
||||
BOOL bEnabled = FALSE;
|
||||
float one = 1.0f;
|
||||
float zero= 0.0f;
|
||||
D3DMATERIAL7 mat;
|
||||
|
||||
/* Set a few lights with funky indices. */
|
||||
memset(&light, 0, sizeof(light));
|
||||
@ -315,6 +316,26 @@ static void LightTest(void)
|
||||
light.dvAttenuation0 = -1.0;
|
||||
rc = IDirect3DDevice7_SetLight(lpD3DDevice, 103, &light);
|
||||
ok(rc==D3D_OK, "SetLight returned: %x\n", rc);
|
||||
|
||||
memset(&mat, 0, sizeof(mat));
|
||||
rc = IDirect3DDevice7_SetMaterial(lpD3DDevice, &mat);
|
||||
ok(rc == D3D_OK, "IDirect3DDevice7_SetMaterial returned: %x\n", rc);
|
||||
|
||||
mat.power = 129.0;
|
||||
rc = IDirect3DDevice7_SetMaterial(lpD3DDevice, &mat);
|
||||
ok(rc == D3D_OK, "IDirect3DDevice7_SetMaterial(power = 129.0) returned: %x\n", rc);
|
||||
memset(&mat, 0, sizeof(mat));
|
||||
rc = IDirect3DDevice7_GetMaterial(lpD3DDevice, &mat);
|
||||
ok(rc == D3D_OK, "IDirect3DDevice7_GetMaterial returned: %x\n", rc);
|
||||
ok(mat.power == 129, "Returned power is %f\n", mat.power);
|
||||
|
||||
mat.power = -1.0;
|
||||
rc = IDirect3DDevice7_SetMaterial(lpD3DDevice, &mat);
|
||||
ok(rc == D3D_OK, "IDirect3DDevice7_SetMaterial(power = -1.0) returned: %x\n", rc);
|
||||
memset(&mat, 0, sizeof(mat));
|
||||
rc = IDirect3DDevice7_GetMaterial(lpD3DDevice, &mat);
|
||||
ok(rc == D3D_OK, "IDirect3DDevice7_GetMaterial returned: %x\n", rc);
|
||||
ok(mat.power == -1, "Returned power is %f\n", mat.power);
|
||||
}
|
||||
|
||||
static void ProcessVerticesTest(void)
|
||||
|
@ -509,8 +509,20 @@ state_specularenable(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCon
|
||||
if (stateblock->renderState[WINED3DRS_SPECULARENABLE]) {
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) &stateblock->material.Specular);
|
||||
checkGLcall("glMaterialfv");
|
||||
|
||||
if(stateblock->material.Power > 128.0) {
|
||||
/* glMaterialf man page says that the material says that GL_SHININESS must be between 0.0
|
||||
* and 128.0, although in d3d neither -1 nor 129 produce an error. For values > 128 clamp
|
||||
* them, since 128 results in a hardly visible specular highlight, so it should be safe to
|
||||
* to clamp to 128
|
||||
*/
|
||||
WARN("Material power > 128\n");
|
||||
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 128.0);
|
||||
} else {
|
||||
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, stateblock->material.Power);
|
||||
}
|
||||
checkGLcall("glMaterialf(GL_SHININESS");
|
||||
|
||||
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
|
||||
glEnable(GL_COLOR_SUM_EXT);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user