Factorize godray visibility test in its own function.
This commit is contained in:
@@ -264,6 +264,7 @@ private:
|
||||
void renderSolidSecondPass();
|
||||
void renderTransparent();
|
||||
void renderParticles();
|
||||
void computeSunVisibility();
|
||||
void computeCameraMatrix(scene::ICameraSceneNode * const camnode,
|
||||
Camera * const camera);
|
||||
void renderShadows(//ShadowImportanceProvider * const sicb,
|
||||
|
||||
@@ -233,34 +233,7 @@ void IrrDriver::renderGLSL(float dt)
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
|
||||
PROFILER_PUSH_CPU_MARKER("- Lensflare/godray", 0x00, 0xFF, 0xFF);
|
||||
// Is the lens flare enabled & visible? Check last frame's query.
|
||||
const bool hasflare = World::getWorld()->getTrack()->hasLensFlare();
|
||||
const bool hasgodrays = World::getWorld()->getTrack()->hasGodRays();
|
||||
if (UserConfigParams::m_light_shaft && hasgodrays)//hasflare || hasgodrays)
|
||||
{
|
||||
GLuint res = 0;
|
||||
if (m_query_issued)
|
||||
gl_driver->extGlGetQueryObjectuiv(m_lensflare_query, GL_QUERY_RESULT, &res);
|
||||
m_post_processing->setSunPixels(res);
|
||||
|
||||
// Prepare the query for the next frame.
|
||||
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
gl_driver->extGlBeginQuery(GL_SAMPLES_PASSED_ARB, m_lensflare_query);
|
||||
m_scene_manager->setCurrentRendertime(scene::ESNRP_SOLID);
|
||||
m_scene_manager->drawAll(scene::ESNRP_CAMERA);
|
||||
irr_driver->setPhase(GLOW_PASS);
|
||||
m_sun_interposer->render();
|
||||
gl_driver->extGlEndQuery(GL_SAMPLES_PASSED_ARB);
|
||||
m_query_issued = true;
|
||||
|
||||
m_lensflare->setStrength(res / 4000.0f);
|
||||
|
||||
if (hasflare)
|
||||
m_lensflare->OnRegisterSceneNode();
|
||||
|
||||
// Make sure the color mask is reset
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
}
|
||||
computeSunVisibility();
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
|
||||
// We need to re-render camera due to the per-cam-node hack.
|
||||
@@ -420,6 +393,39 @@ void IrrDriver::renderFixed(float dt)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void IrrDriver::computeSunVisibility()
|
||||
{
|
||||
// Is the lens flare enabled & visible? Check last frame's query.
|
||||
const bool hasflare = World::getWorld()->getTrack()->hasLensFlare();
|
||||
const bool hasgodrays = World::getWorld()->getTrack()->hasGodRays();
|
||||
irr::video::COpenGLDriver* gl_driver = (irr::video::COpenGLDriver*)m_device->getVideoDriver();
|
||||
if (UserConfigParams::m_light_shaft && hasgodrays)//hasflare || hasgodrays)
|
||||
{
|
||||
GLuint res = 0;
|
||||
if (m_query_issued)
|
||||
gl_driver->extGlGetQueryObjectuiv(m_lensflare_query, GL_QUERY_RESULT, &res);
|
||||
m_post_processing->setSunPixels(res);
|
||||
|
||||
// Prepare the query for the next frame.
|
||||
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||
gl_driver->extGlBeginQuery(GL_SAMPLES_PASSED_ARB, m_lensflare_query);
|
||||
m_scene_manager->setCurrentRendertime(scene::ESNRP_SOLID);
|
||||
m_scene_manager->drawAll(scene::ESNRP_CAMERA);
|
||||
irr_driver->setPhase(GLOW_PASS);
|
||||
m_sun_interposer->render();
|
||||
gl_driver->extGlEndQuery(GL_SAMPLES_PASSED_ARB);
|
||||
m_query_issued = true;
|
||||
|
||||
m_lensflare->setStrength(res / 4000.0f);
|
||||
|
||||
if (hasflare)
|
||||
m_lensflare->OnRegisterSceneNode();
|
||||
|
||||
// Make sure the color mask is reset
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
void IrrDriver::renderSolidFirstPass()
|
||||
{
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_rtts->getFBO(FBO_NORMAL_AND_DEPTHS));
|
||||
|
||||
Reference in New Issue
Block a user