From a35e9daaef3c4342e7c4881dbb535c96ecc7bc34 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Mon, 4 Nov 2013 19:21:37 +0000 Subject: [PATCH] BGE Rasterizer Cleanup: Moving the RAS_OpenGLRasterizer::ApplyLights() code into RAS_OpenGLRasterizer::ProcessLighting(). --- .../RAS_OpenGLRasterizer.cpp | 58 +++++++++---------- .../RAS_OpenGLRasterizer.h | 1 - 2 files changed, 27 insertions(+), 32 deletions(-) diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index cdfeac5ce9c..2bd988145c3 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -1159,8 +1159,33 @@ void RAS_OpenGLRasterizer::ProcessLighting(bool uselights, const MT_Transform& v m_lastauxinfo = m_auxilaryClientInfo; /* enable/disable lights as needed */ - if (layer >= 0) - enable = ApplyLights(layer, viewmat); + if (layer >= 0) { + //enable = ApplyLights(layer, viewmat); + // taken from blender source, incompatibility between Blender Object / GameObject + KX_Scene* kxscene = (KX_Scene*)m_auxilaryClientInfo; + float glviewmat[16]; + unsigned int count; + std::vector::iterator lit = m_lights.begin(); + + for (count=0; countm_light; + + if (kxlight->ApplyLight(kxscene, layer, count)) + count++; + } + glPopMatrix(); + + enable = count > 0; + } if (enable) EnableOpenGLLights(); @@ -1508,35 +1533,6 @@ void RAS_OpenGLRasterizer::PopMatrix() glPopMatrix(); } - -int RAS_OpenGLRasterizer::ApplyLights(int objectlayer, const MT_Transform& viewmat) -{ - // taken from blender source, incompatibility between Blender Object / GameObject - KX_Scene* kxscene = (KX_Scene*)m_auxilaryClientInfo; - float glviewmat[16]; - unsigned int count; - std::vector::iterator lit = m_lights.begin(); - - for (count=0; countm_light; - - if (kxlight->ApplyLight(kxscene, objectlayer, count)) - count++; - } - glPopMatrix(); - - return count; -} - void RAS_OpenGLRasterizer::MotionBlur() { int state = GetMotionBlurState(); diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h index a6fa057e6c0..1fc97201480 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h @@ -367,7 +367,6 @@ public: int height); void applyTransform(double* oglmatrix, int objectdrawmode); - int applyLights(int objectlayer, const MT_Transform& viewmat); void PushMatrix(); void PopMatrix();