Disable lights when the material isn't lighted.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 11 years ago
parent 2a158e76e1
commit fb38a7a0a7

@ -1181,6 +1181,7 @@ private:
void setLightInternal(uint8 num, const CLight& light);
void enableLightInternal(uint8 num, bool enable);
void setupLightMapDynamicLighting(bool enable);
void disableAllLights();
/// \name VertexBufferHard

@ -199,6 +199,14 @@ void CDriverGL3::setupLightMapDynamicLighting(bool enable)
}
}
void CDriverGL3::disableAllLights()
{
for( int i = 0; i < MaxLight; i++ )
{
_UserLightEnable[ i ] = false;
}
}
#ifdef NL_STATIC
} // NLDRIVERGL/ES
#endif

@ -433,6 +433,9 @@ bool CDriverGL3::setupMaterial(CMaterial& mat)
// Light Part.
_DriverGLStates.enableLighting(mat.getFlags()&IDRV_MAT_LIGHTING);
if( ( mat.getFlags() & IDRV_MAT_LIGHTING ) == 0 )
disableAllLights();
if(mat.getFlags()&IDRV_MAT_LIGHTING)
{
_DriverGLStates.setEmissive(pShader->PackedEmissive, pShader->Emissive);

@ -261,13 +261,6 @@ void CDriverGLStates3::enableLighting(uint enable)
{
// new state.
_CurLighting= enabled;
// Setup GLState.
if(_CurLighting)
glEnable(GL_LIGHTING);
else
{
glDisable(GL_LIGHTING);
}
}
}

Loading…
Cancel
Save