RTT: calculate diffuse coefficients only once

This commit is contained in:
Marianne Gagnon 2015-06-15 19:47:52 -04:00
parent fa027c11da
commit 01b9ee2a63
2 changed files with 9 additions and 1 deletions

View File

@ -56,6 +56,7 @@ RTT::RTT(size_t width, size_t height)
m_RH_FBO = NULL;
m_RSM = NULL;
m_RH_FBO = NULL;
m_diffuse_coefficients_calculated = false;
using namespace video;
using namespace core;
@ -294,7 +295,12 @@ void RTT::prepareRender(scene::ICameraSceneNode* camera)
{
irr_driver->setRTT(this);
irr_driver->getSceneManager()->setActiveCamera(camera);
irr_driver->generateDiffuseCoefficients();
if (!m_diffuse_coefficients_calculated)
{
irr_driver->generateDiffuseCoefficients();
m_diffuse_coefficients_calculated = true;
}
}
FrameBuffer* RTT::render(scene::ICameraSceneNode* camera, float dt)

View File

@ -62,6 +62,8 @@ private:
int m_width;
int m_height;
bool m_diffuse_coefficients_calculated;
unsigned shadowColorTex, shadowNormalTex, shadowDepthTex;
unsigned RSM_Color, RSM_Normal, RSM_Depth;
unsigned RH_Red, RH_Green, RH_Blue;