Do not enter renderLights if dynamic light is disabled

This commit is contained in:
Vincent Lejeune 2014-09-16 19:24:47 +02:00
parent d6d4b1948c
commit b9c547278f
3 changed files with 11 additions and 8 deletions

View File

@ -335,7 +335,8 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po
// Lights
{
PROFILER_PUSH_CPU_MARKER("- Light", 0x00, 0xFF, 0x00);
renderLights(pointlightcount, hasShadow);
if (UserConfigParams::m_dynamic_lights)
renderLights(pointlightcount, hasShadow);
PROFILER_POP_CPU_MARKER();
}

View File

@ -164,11 +164,7 @@ void IrrDriver::renderLights(unsigned pointlightcount, bool hasShadow)
for (unsigned i = 0; i < sun_ortho_matrix.size(); i++)
sun_ortho_matrix[i] *= getInvViewMatrix();
m_rtts->getFBO(FBO_COMBINED_DIFFUSE_SPECULAR).Bind();
if (!UserConfigParams::m_dynamic_lights)
glClearColor(.5, .5, .5, .5);
glClear(GL_COLOR_BUFFER_BIT);
if (!UserConfigParams::m_dynamic_lights)
return;
m_rtts->getFBO(FBO_DIFFUSE).Bind();
if (UserConfigParams::m_gi && UserConfigParams::m_shadows && hasShadow)

View File

@ -179,9 +179,6 @@ RTT::RTT(size_t width, size_t height)
somevector.clear();
somevector.push_back(RenderTargetTextures[RTT_HALF1_R]);
FrameBuffers.push_back(new FrameBuffer(somevector, half.Width, half.Height));
// Clear this FBO to 1s so that if no SSAO is computed we can still use it.
glClearColor(1., 1., 1., 1.);
glClear(GL_COLOR_BUFFER_BIT);
somevector.clear();
somevector.push_back(RenderTargetTextures[RTT_HALF2]);
@ -258,6 +255,15 @@ RTT::RTT(size_t width, size_t height)
somevector.push_back(RH_Blue);
m_RH_FBO = new FrameBuffer(somevector, 32, 16, true);
}
// Clear this FBO to 1s so that if no SSAO is computed we can still use it.
getFBO(FBO_HALF1_R).Bind();
glClearColor(1., 1., 1., 1.);
glClear(GL_COLOR_BUFFER_BIT);
getFBO(FBO_COMBINED_DIFFUSE_SPECULAR).Bind();
glClearColor(.5, .5, .5, .5);
glClear(GL_COLOR_BUFFER_BIT);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}