diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2013-11-04 23:21:37 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2013-11-04 23:21:37 +0400 |
commit | a35e9daaef3c4342e7c4881dbb535c96ecc7bc34 (patch) | |
tree | a89b4aa352f7e79a0455653bff1ca800f0d86363 /source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp | |
parent | c1e617d26bf72f6fe2682c14e31b84864b465e85 (diff) |
BGE Rasterizer Cleanup: Moving the RAS_OpenGLRasterizer::ApplyLights() code into RAS_OpenGLRasterizer::ProcessLighting().
Diffstat (limited to 'source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp')
-rw-r--r-- | source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp | 58 |
1 files changed, 27 insertions, 31 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<struct RAS_LightObject*>::iterator lit = m_lights.begin(); + + for (count=0; count<m_numgllights; count++) + glDisable((GLenum)(GL_LIGHT0+count)); + + viewmat.getValue(glviewmat); + + glPushMatrix(); + glLoadMatrixf(glviewmat); + for (lit = m_lights.begin(), count = 0; !(lit==m_lights.end()) && count < m_numgllights; ++lit) + { + RAS_LightObject* lightdata = (*lit); + KX_LightObject *kxlight = (KX_LightObject*)lightdata->m_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<struct RAS_LightObject*>::iterator lit = m_lights.begin(); - - for (count=0; count<m_numgllights; count++) - glDisable((GLenum)(GL_LIGHT0+count)); - - viewmat.getValue(glviewmat); - - glPushMatrix(); - glLoadMatrixf(glviewmat); - for (lit = m_lights.begin(), count = 0; !(lit==m_lights.end()) && count < m_numgllights; ++lit) - { - RAS_LightObject* lightdata = (*lit); - KX_LightObject *kxlight = (KX_LightObject*)lightdata->m_light; - - if (kxlight->ApplyLight(kxscene, objectlayer, count)) - count++; - } - glPopMatrix(); - - return count; -} - void RAS_OpenGLRasterizer::MotionBlur() { int state = GetMotionBlurState(); |