Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-02-06 22:21:24 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-02-06 22:21:24 +0300
commite40803a5b3ac860f895c2180fe90f0040f3583d5 (patch)
tree992d30305f2b27bd0f607c3dbb274a7fb4d1d388 /source/gameengine/GamePlayer/common
parent09099111e39a7363fa186c4200b60b3b2bd93f9e (diff)
Fix for bug #18228: OpenGL specular did not get the correct view
vector in perspective mode. This is default OpenGL behavior, but by now this optimization is really insignificant. Works in both the 3d view and game engine.
Diffstat (limited to 'source/gameengine/GamePlayer/common')
-rw-r--r--source/gameengine/GamePlayer/common/GPC_RenderTools.cpp9
-rw-r--r--source/gameengine/GamePlayer/common/GPC_RenderTools.h4
2 files changed, 7 insertions, 6 deletions
diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
index 78d8eaf2aa3..c0d6248a3ca 100644
--- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
@@ -85,7 +85,7 @@ void GPC_RenderTools::EndFrame(RAS_IRasterizer* rasty)
* has a maximum of 8 lights (simultaneous), so 20 * 8 lights are possible in
* a scene. */
-void GPC_RenderTools::ProcessLighting(int layer, const MT_Transform& viewmat)
+void GPC_RenderTools::ProcessLighting(RAS_IRasterizer *rasty, int layer, const MT_Transform& viewmat)
{
if(m_lastlightlayer == layer)
return;
@@ -106,12 +106,12 @@ void GPC_RenderTools::ProcessLighting(int layer, const MT_Transform& viewmat)
}
if(enable)
- EnableOpenGLLights();
+ EnableOpenGLLights(rasty);
else
DisableOpenGLLights();
}
-void GPC_RenderTools::EnableOpenGLLights()
+void GPC_RenderTools::EnableOpenGLLights(RAS_IRasterizer *rasty)
{
if(m_lastlighting == true)
return;
@@ -120,7 +120,8 @@ void GPC_RenderTools::EnableOpenGLLights()
glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
- glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, true);
+ glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
+ glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, (rasty->GetCameraOrtho())? GL_FALSE: GL_TRUE);
if (GLEW_EXT_separate_specular_color || GLEW_VERSION_1_2)
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.h b/source/gameengine/GamePlayer/common/GPC_RenderTools.h
index 382956e73ea..2a1b66a3aa9 100644
--- a/source/gameengine/GamePlayer/common/GPC_RenderTools.h
+++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.h
@@ -65,9 +65,9 @@ public:
void EndFrame(RAS_IRasterizer* rasty);
void BeginFrame(RAS_IRasterizer* rasty);
- void EnableOpenGLLights();
+ void EnableOpenGLLights(RAS_IRasterizer *rasty);
void DisableOpenGLLights();
- void ProcessLighting(int layer, const MT_Transform& viewmat);
+ void ProcessLighting(RAS_IRasterizer *rasty, int layer, const MT_Transform& viewmat);
/* @attention mode is ignored here */
void RenderText2D(RAS_TEXT_RENDER_MODE mode,