Commit 252780ce authored by Philip Trettner's avatar Philip Trettner

More rendering pipeline improvements

parent 09d04e59
......@@ -2,6 +2,8 @@
#include "RenderPassType.hh"
#include <glow/fwd.hh>
namespace glow
{
namespace camera
......@@ -28,6 +30,11 @@ struct RenderPass
/// Backreference to current pipeline
RenderingPipeline* pipeline = nullptr;
/// Currently bound depth buffer
SharedTextureRectangle depthTarget = nullptr;
/// Currently bound framebuffer
SharedFramebuffer framebuffer = nullptr;
};
}
}
......@@ -49,8 +49,8 @@ RenderingPipeline::RenderingPipeline()
mFboZPre = Framebuffer::create({{"fNormal", mTargetNormals}}, mTargetDepth);
mFboForward = Framebuffer::create({{"fColor", mTargetColor}}, mTargetDepth);
mFboTransparent = Framebuffer::create({{"fAccum", mTargetTranspAccum}, {"fRevealage", mTargetTranspReveal}}, mTargetDepth);
mFboToColor = Framebuffer::create({{"fColor", mTargetColor}});
mFboToColorTmp = Framebuffer::create({{"fColor", mTargetColorTmp}});
mFboToColor = Framebuffer::create({{"fColor", mTargetColor}}, mTargetDepth);
mFboToColorTmp = Framebuffer::create({{"fColor", mTargetColorTmp}}, mTargetDepth);
}
void RenderingPipeline::resize(int w, int h)
......@@ -95,6 +95,8 @@ void RenderingPipeline::render(const std::function<void(RenderPass const& pass)>
rp.type = RenderPassType::ZPre;
rp.pipeline = this;
rp.camera = &cam;
rp.depthTarget = mTargetDepth;
rp.framebuffer = mFboZPre;
auto fbo = mFboZPre->bind();
......@@ -116,6 +118,8 @@ void RenderingPipeline::render(const std::function<void(RenderPass const& pass)>
rp.type = RenderPassType::Opaque;
rp.pipeline = this;
rp.camera = &cam;
rp.depthTarget = mTargetDepth;
rp.framebuffer = mFboForward;
auto fbo = mFboForward->bind();
......@@ -132,6 +136,8 @@ void RenderingPipeline::render(const std::function<void(RenderPass const& pass)>
rp.type = RenderPassType::Transparent;
rp.pipeline = this;
rp.camera = &cam;
rp.depthTarget = mTargetDepth;
rp.framebuffer = mFboTransparent;
auto fbo = mFboTransparent->bind();
......@@ -157,6 +163,7 @@ void RenderingPipeline::render(const std::function<void(RenderPass const& pass)>
}
{
GLOW_SCOPED(depthMask, GL_FALSE);
GLOW_SCOPED(disable, GL_DEPTH_TEST);
GLOW_SCOPED(disable, GL_CULL_FACE);
......@@ -172,6 +179,8 @@ void RenderingPipeline::render(const std::function<void(RenderPass const& pass)>
rp.type = RenderPassType::PostprocessOpaque;
rp.pipeline = this;
rp.camera = &cam;
rp.depthTarget = mTargetDepth;
rp.framebuffer = (toColorTmp ? mFboToColor : mFboToColorTmp);
auto fbo = (toColorTmp ? mFboToColor : mFboToColorTmp)->bind();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment