diff --git a/source/light/LightSystem.cpp b/source/light/LightSystem.cpp index 63724c999cb61291ab477763705f2e40c2bd6946..4e3a3d8385859b29ac5381fae25cabd43413e33f 100644 --- a/source/light/LightSystem.cpp +++ b/source/light/LightSystem.cpp @@ -584,7 +584,7 @@ void XMETHODCALLTYPE CLightSystem::updateVisibility() for(UINT i = 0, l = m_aLights.size(); i < l; ++i) { - if(m_aLights[i]->isEnabled()) + if(m_aLights[i]->isEnabled() && m_aLights[i]->isDirty(LRT_ALL)) { m_aLights[i]->updateVisibility(m_pMainCamera, vLPVmin, vLPVmax, iCascades > 0); } diff --git a/source/light/ShadowCache.h b/source/light/ShadowCache.h index 5e20f66c60ce6e9259436cf44779dd718865b727..52c444ac094254c718a0f5bd60abfad8da134ea6 100644 --- a/source/light/ShadowCache.h +++ b/source/light/ShadowCache.h @@ -205,6 +205,10 @@ protected: { m_aMapsQueue[uMap]->isDirty = true; m_aMapsQueue[uMap]->shouldProcess = true; + if(m_aMapsQueue[uMap]->pLight) + { + m_aMapsQueue[uMap]->pLight->markDirty(m_renderType); + } m_aMapsQueue[uMap]->pLight = m_aFrameLights[i]; m_aFrameLights.erase(i); return(true); diff --git a/source/light/light.h b/source/light/light.h index 5f223253174821c2e298dc4027accb9470b7e606..4aef102666c11605dff1c48ca00ee03b7cb2ff40 100644 --- a/source/light/light.h +++ b/source/light/light.h @@ -81,6 +81,10 @@ public: { m_dirty &= ~type; } + void markDirty(LIGHT_RENDER_TYPE type) + { + m_dirty |= type; + } protected: virtual SMMATRIX getWorldTM();