From 06e7aa68b0c9430f59810064d9f67e1afdba6f4d Mon Sep 17 00:00:00 2001 From: Vincent Pelletier Date: Mon, 16 Mar 2015 22:53:52 +0100 Subject: [PATCH] GRIM: Correct diffuse reflectance. Determined by keping a single directional light source enabled, as they are not subject to attenuation (having no position), and comparing with original software renderer. Default DirectX material reflects all diffuse light, so 1.0f coefficient is likely correct. --- engines/grim/gfx_opengl.cpp | 2 ++ engines/grim/gfx_tinygl.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/engines/grim/gfx_opengl.cpp b/engines/grim/gfx_opengl.cpp index d3e8d70bdb1..fab0496a20f 100644 --- a/engines/grim/gfx_opengl.cpp +++ b/engines/grim/gfx_opengl.cpp @@ -158,6 +158,8 @@ 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 diffuseReflectance[] = { 1.0f, 1.0f, 1.0f, 1.0f }; + glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuseReflectance); if (g_grim->getGameType() == GType_GRIM) { glPolygonOffset(-6.0, -6.0); diff --git a/engines/grim/gfx_tinygl.cpp b/engines/grim/gfx_tinygl.cpp index 9fc81907f4a..df45510ecd5 100644 --- a/engines/grim/gfx_tinygl.cpp +++ b/engines/grim/gfx_tinygl.cpp @@ -103,6 +103,8 @@ byte *GfxTinyGL::setupScreen(int screenW, int screenH, bool fullscreen) { TGLfloat ambientSource[] = { 0.0f, 0.0f, 0.0f, 1.0f }; tglLightModelfv(TGL_LIGHT_MODEL_AMBIENT, ambientSource); + TGLfloat diffuseReflectance[] = { 1.0f, 1.0f, 1.0f, 1.0f }; + tglMaterialfv(TGL_FRONT, TGL_DIFFUSE, diffuseReflectance); // we now generate a buffer (id 1), which we will use as a backing buffer, where the actors' clean buffers // will blit to. everu frame this will be blitted to screen, but the actors' buffers will be blitted to