X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Frender%2Fsequence.cpp;h=e2986a249904a8c1fae136c6ef90e21a6d5c26bb;hb=HEAD;hp=2a5b351c888d2b7e3c609706061f8ae352301bda;hpb=0fa506250545acb83bc86f1734826544d6f1eda6;p=libs%2Fgl.git diff --git a/source/render/sequence.cpp b/source/render/sequence.cpp index 2a5b351c..4f10026a 100644 --- a/source/render/sequence.cpp +++ b/source/render/sequence.cpp @@ -12,7 +12,7 @@ using namespace std; namespace Msp { namespace GL { -Tag Sequence::noclear_tag = "noclear"; +const Tag Sequence::noclear_tag = "noclear"; Sequence::Sequence(unsigned w, unsigned h, const FrameFormat &f): width(w), @@ -65,7 +65,7 @@ void Sequence::set_clear_stencil(int s) Sequence::Step &Sequence::add_step(Tag tag, Renderable &r) { - steps.push_back(Step(tag, &r)); + steps.emplace_back(tag, &r); return steps.back(); } @@ -109,7 +109,7 @@ void Sequence::render(Renderer &renderer, Tag tag) const throw invalid_operation("Sequence::render"); const FrameFormat &format = target_fbo->get_format(); - ClearValue clear_values[7]; + ClearValue clear_values[FrameFormat::MAX_ATTACHMENTS]; unsigned i = 0; Color default_color = (clear_colors.empty() ? Color(0.0f, 0.0f, 0.0f, 0.0f) : clear_colors.front()); ClearValue *cv = clear_values; @@ -143,8 +143,12 @@ void Sequence::render(Renderer &renderer, Tag tag) const if(target[0]) { + RenderTarget *source = target[0]; if(target_ms) - renderer.resolve_multisample(target[0]->get_framebuffer()); + { + renderer.resolve_multisample(); + source = target_ms; + } renderer.set_depth_test(0); renderer.set_stencil_test(0); @@ -152,11 +156,12 @@ void Sequence::render(Renderer &renderer, Tag tag) const for(unsigned i=0; iget_framebuffer() : out_fbo); - const Texture2D &color = target[j]->get_target_texture(COLOR_ATTACHMENT); - const Texture2D &depth = target[j]->get_target_texture(DEPTH_ATTACHMENT); + unsigned j = 1-i%2; + renderer.set_framebuffer(i+1get_framebuffer() : out_fbo); + const Texture2D &color = source->get_target_texture(COLOR_ATTACHMENT); + const Texture2D &depth = source->get_target_texture(DEPTH_ATTACHMENT); postproc[i]->render(renderer, color, depth); + source = target[j]; } } }