Fix shadow visualization
This commit is contained in:
parent
9e90bd251d
commit
4194977df5
@ -209,13 +209,13 @@ public:
|
||||
// ------------------------------------------------------------------------
|
||||
void render(GLuint normal_depth_texture,
|
||||
GLuint depth_stencil_texture,
|
||||
const FrameBuffer& shadow_framebuffer,
|
||||
const FrameBuffer* shadow_framebuffer,
|
||||
const core::vector3df &direction,
|
||||
const video::SColorf &col)
|
||||
{
|
||||
setTextureUnits(normal_depth_texture,
|
||||
depth_stencil_texture,
|
||||
shadow_framebuffer.getDepthTexture() );
|
||||
shadow_framebuffer->getDepthTexture() );
|
||||
drawFullScreenEffect(ShadowMatrices::m_shadow_split[1],
|
||||
ShadowMatrices::m_shadow_split[2],
|
||||
ShadowMatrices::m_shadow_split[3],
|
||||
@ -418,7 +418,7 @@ void LightingPasses::updateLightsInfo(scene::ICameraSceneNode * const camnode,
|
||||
void LightingPasses::renderLights( bool has_shadow,
|
||||
GLuint normal_depth_texture,
|
||||
GLuint depth_stencil_texture,
|
||||
const FrameBuffer& shadow_framebuffer,
|
||||
const FrameBuffer* shadow_framebuffer,
|
||||
GLuint specular_probe)
|
||||
{
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
void renderLights( bool has_shadow,
|
||||
GLuint normal_depth_texture,
|
||||
GLuint depth_stencil_texture,
|
||||
const FrameBuffer& shadow_framebuffer,
|
||||
const FrameBuffer* shadow_framebuffer,
|
||||
GLuint specular_probe);
|
||||
void renderLightsScatter(GLuint depth_stencil_texture,
|
||||
const FrameBuffer& half1_framebuffer,
|
||||
|
@ -149,7 +149,7 @@ public:
|
||||
unsigned int getWidth () const { return m_width ; }
|
||||
unsigned int getHeight() const { return m_height; }
|
||||
|
||||
FrameBufferLayer &getShadowFrameBuffer() { return *m_shadow_FBO; }
|
||||
FrameBufferLayer* getShadowFrameBuffer() { return m_shadow_FBO; }
|
||||
unsigned getDepthStencilTexture() const { return DepthStencilTexture; }
|
||||
unsigned getRenderTarget(enum TypeRTT target) const { return RenderTargetTextures[target]; }
|
||||
FrameBuffer& getFBO(enum TypeFBO fbo) { return FrameBuffers[fbo]; }
|
||||
|
@ -187,7 +187,7 @@ void ShaderBasedRenderer::renderShadows()
|
||||
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
for (unsigned cascade = 0; cascade < 4; cascade++)
|
||||
{
|
||||
m_rtts->getShadowFrameBuffer().bindLayerDepthOnly(cascade);
|
||||
m_rtts->getShadowFrameBuffer()->bindLayerDepthOnly(cascade);
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
SP::sp_cur_shadow_cascade = cascade;
|
||||
ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_SHADOWS_CASCADE0 + cascade));
|
||||
@ -596,7 +596,7 @@ void ShaderBasedRenderer::renderPostProcessing(Camera * const camera)
|
||||
camera->activate();
|
||||
m_post_processing->renderPassThrough(m_rtts->getFBO(FBO_HALF1_R).getRTT()[0], viewport.LowerRightCorner.X - viewport.UpperLeftCorner.X, viewport.LowerRightCorner.Y - viewport.UpperLeftCorner.Y);
|
||||
}
|
||||
else if (irr_driver->getShadowViz())
|
||||
else if (irr_driver->getShadowViz() && m_rtts->getShadowFrameBuffer())
|
||||
{
|
||||
m_shadow_matrices.renderShadowsDebug(m_rtts->getShadowFrameBuffer(), m_post_processing);
|
||||
}
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "config/user_config.hpp"
|
||||
#include "graphics/central_settings.hpp"
|
||||
#include "graphics/frame_buffer.hpp"
|
||||
#include "graphics/glwrap.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/post_processing.hpp"
|
||||
#include "graphics/rtts.hpp"
|
||||
@ -320,24 +319,24 @@ void ShadowMatrices::renderWireFrameFrustrum(float *tmp, unsigned i)
|
||||
glDrawElements(GL_LINES, 24, GL_UNSIGNED_INT, 0);
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
void ShadowMatrices::renderShadowsDebug(const FrameBuffer &shadow_framebuffer,
|
||||
void ShadowMatrices::renderShadowsDebug(const FrameBuffer* shadow_framebuffer,
|
||||
const PostProcessing *post_processing)
|
||||
{
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glViewport(0, UserConfigParams::m_height / 2,
|
||||
UserConfigParams::m_width / 2, UserConfigParams::m_height / 2);
|
||||
post_processing->renderTextureLayer(shadow_framebuffer.getRTT()[0], 0);
|
||||
post_processing->renderTextureLayer(shadow_framebuffer->getDepthTexture(), 0);
|
||||
renderWireFrameFrustrum(m_shadows_cam[0], 0);
|
||||
glViewport(UserConfigParams::m_width / 2, UserConfigParams::m_height / 2,
|
||||
UserConfigParams::m_width / 2, UserConfigParams::m_height / 2);
|
||||
post_processing->renderTextureLayer(shadow_framebuffer.getRTT()[0], 1);
|
||||
post_processing->renderTextureLayer(shadow_framebuffer->getDepthTexture(), 1);
|
||||
renderWireFrameFrustrum(m_shadows_cam[1], 1);
|
||||
glViewport(0, 0, UserConfigParams::m_width / 2, UserConfigParams::m_height / 2);
|
||||
post_processing->renderTextureLayer(shadow_framebuffer.getRTT()[0], 2);
|
||||
post_processing->renderTextureLayer(shadow_framebuffer->getDepthTexture(), 2);
|
||||
renderWireFrameFrustrum(m_shadows_cam[2], 2);
|
||||
glViewport(UserConfigParams::m_width / 2, 0, UserConfigParams::m_width / 2,
|
||||
UserConfigParams::m_height / 2);
|
||||
post_processing->renderTextureLayer(shadow_framebuffer.getRTT()[0], 3);
|
||||
post_processing->renderTextureLayer(shadow_framebuffer->getDepthTexture(), 3);
|
||||
renderWireFrameFrustrum(m_shadows_cam[3], 3);
|
||||
glViewport(0, 0, UserConfigParams::m_width, UserConfigParams::m_height);
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
GLuint depth_stencil_texture);
|
||||
void addLight(const core::vector3df &pos);
|
||||
void updateSunOrthoMatrices();
|
||||
void renderShadowsDebug(const FrameBuffer &shadow_framebuffer,
|
||||
void renderShadowsDebug(const FrameBuffer* shadow_framebuffer,
|
||||
const PostProcessing *post_processing);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user