BGE Rasterizer Cleanup: Moving the RAS_OpenGLRasterizer::ApplyLights() code into...
authorMitchell Stokes <mogurijin@gmail.com>
Mon, 4 Nov 2013 19:21:37 +0000 (19:21 +0000)
committerMitchell Stokes <mogurijin@gmail.com>
Mon, 4 Nov 2013 19:21:37 +0000 (19:21 +0000)
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h

index cdfeac5ce9cd90d4b77b67a070666f7de638bab9..2bd988145c3c67fce20d8ced1b52d0289f60cc2d 100644 (file)
@@ -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();
index a6fa057e6c01d6cf867b1befb047028e165691ab..1fc97201480a3edd515840b87907652872ebbe02 100644 (file)
@@ -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();