From 6e996d145b9dee8a01d64d8db320bfb92a4dc4e1 Mon Sep 17 00:00:00 2001 From: Vincent Pelletier Date: Sun, 15 Mar 2015 22:02:26 +0100 Subject: [PATCH] GRIM: Disable specular lighting. My initial idea that GRIM would use specular likely came from a difference between DirectX and OpenGL lighting for spotlights: DirectX allows for an extra penumbra angle, allowing stronger center spots while maintaining a smooth fade (which I emulated with a fixed 2.0 exponent). Also, specular involves an extra light color value and material definition for specular reflection, which are not visible in game data files. All this making the use of specular very unlikely to match original renderer. --- engines/grim/gfx_opengl.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/engines/grim/gfx_opengl.cpp b/engines/grim/gfx_opengl.cpp index ad7d7cbcccf..b9de9d0ae5e 100644 --- a/engines/grim/gfx_opengl.cpp +++ b/engines/grim/gfx_opengl.cpp @@ -158,8 +158,6 @@ byte *GfxOpenGL::setupScreen(int screenW, int screenH, bool fullscreen) { GLfloat ambientSource[] = { 0.0f, 0.0f, 0.0f, 1.0f }; glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambientSource); - GLfloat specularReflectance[] = { 0.3f, 0.3f, 0.3f, 1.0f }; - glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specularReflectance); if (g_grim->getGameType() == GType_GRIM) { glPolygonOffset(-6.0, -6.0); @@ -970,17 +968,16 @@ void GfxOpenGL::setupLight(Light *light, int lightId) { } glEnable(GL_LIGHTING); - GLfloat diffuse[] = { 0.0f, 0.0f, 0.0f, 1.0f }; - GLfloat specular[] = { 0.0f, 0.0f, 0.0f, 1.0f }; + GLfloat lightColor[] = { 0.0f, 0.0f, 0.0f, 1.0f }; GLfloat lightPos[] = { 0.0f, 0.0f, 0.0f, 1.0f }; GLfloat lightDir[] = { 0.0f, 0.0f, -1.0f }; GLfloat cutoff = 180.0f; GLfloat spot_exp = 0.0f; GLfloat intensity = light->_intensity; - diffuse[0] = ((GLfloat)light->_color.getRed() / 15.0f) * intensity; - diffuse[1] = ((GLfloat)light->_color.getGreen() / 15.0f) * intensity; - diffuse[2] = ((GLfloat)light->_color.getBlue() / 15.0f) * intensity; + lightColor[0] = ((GLfloat)light->_color.getRed() / 15.0f) * intensity; + lightColor[1] = ((GLfloat)light->_color.getGreen() / 15.0f) * intensity; + lightColor[2] = ((GLfloat)light->_color.getBlue() / 15.0f) * intensity; if (light->_type == Light::Omni) { lightPos[0] = light->_pos.x(); @@ -998,16 +995,12 @@ void GfxOpenGL::setupLight(Light *light, int lightId) { lightDir[0] = light->_dir.x(); lightDir[1] = light->_dir.y(); lightDir[2] = light->_dir.z(); - specular[0] = diffuse[0]; - specular[1] = diffuse[1]; - specular[2] = diffuse[2]; spot_exp = 2.0f; cutoff = light->_penumbraangle; } glDisable(GL_LIGHT0 + lightId); - glLightfv(GL_LIGHT0 + lightId, GL_DIFFUSE, diffuse); - glLightfv(GL_LIGHT0 + lightId, GL_SPECULAR, specular); + glLightfv(GL_LIGHT0 + lightId, GL_DIFFUSE, lightColor); glLightfv(GL_LIGHT0 + lightId, GL_POSITION, lightPos); glLightfv(GL_LIGHT0 + lightId, GL_SPOT_DIRECTION, lightDir); glLightf(GL_LIGHT0 + lightId, GL_SPOT_EXPONENT, spot_exp);