X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Frender%2Fsequence.cpp;h=5d003753bc2738d89fc49d5e34d26956b466ca78;hb=77a534371433054384d213922a2e8c55f8a69ad6;hp=f2a88a51f760ab6ccc6fc9e5c17062ab460824ae;hpb=38712d8ecc57d043a2419ffbaeeb57f7a6586f14;p=libs%2Fgl.git diff --git a/source/render/sequence.cpp b/source/render/sequence.cpp index f2a88a51..5d003753 100644 --- a/source/render/sequence.cpp +++ b/source/render/sequence.cpp @@ -12,6 +12,8 @@ using namespace std; namespace Msp { namespace GL { +Tag Sequence::noclear_tag = "noclear"; + Sequence::Sequence(unsigned w, unsigned h, const FrameFormat &f): width(w), height(h), @@ -31,9 +33,8 @@ Sequence::Sequence(unsigned w, unsigned h, const FrameFormat &f): Sequence::~Sequence() { - for(PostProcStep &p: postproc) - if(p.owned) - delete p.postproc; + for(OwnedObject &o: owned_data) + o.delete_func(o.pointer); delete target[0]; delete target[1]; delete target_ms; @@ -69,24 +70,10 @@ Sequence::Step &Sequence::add_step(Tag tag, Renderable &r) } void Sequence::add_postprocessor(PostProcessor &pp) -{ - add_postprocessor(&pp, false); -} - -void Sequence::add_postprocessor_owned(PostProcessor *pp) -{ - add_postprocessor(pp, true); -} - -void Sequence::add_postprocessor(PostProcessor *pp, bool owned) { if(target_format.empty()) - { - if(owned) - delete pp; throw invalid_operation("Sequence::add_postprocessor"); - } - postproc.push_back(PostProcStep(pp, owned)); + postproc.push_back(&pp); } void Sequence::setup_frame(Renderer &renderer) @@ -105,7 +92,7 @@ void Sequence::finish_frame() void Sequence::render(Renderer &renderer, Tag tag) const { - if(tag.id) + if(tag.id && tag!=noclear_tag) return; Renderer::Push _push(renderer); @@ -115,7 +102,7 @@ void Sequence::render(Renderer &renderer, Tag tag) const if(target[0]) renderer.set_framebuffer(&(target_ms ? target_ms : target[0])->get_framebuffer()); - if(clear_enabled) + if(clear_enabled && tag!=noclear_tag) { const Framebuffer *target_fbo = renderer.get_framebuffer(); if(!target_fbo) @@ -146,11 +133,9 @@ void Sequence::render(Renderer &renderer, Tag tag) const renderer.set_depth_test(&s.get_depth_test()); renderer.set_stencil_test(&s.get_stencil_test()); - renderer.set_blend(&s.get_blend()); - if (const Lighting *lighting = s.get_lighting()) + if(const Lighting *lighting = s.get_lighting()) renderer.add_shader_data(lighting->get_shader_data()); - renderer.set_clipping(s.get_clipping()); if(const Renderable *renderable = s.get_renderable()) renderer.render(*renderable, s.get_tag()); @@ -171,7 +156,7 @@ void Sequence::render(Renderer &renderer, Tag tag) const renderer.set_framebuffer(i+1get_framebuffer() : out_fbo); const Texture2D &color = target[j]->get_target_texture(COLOR_ATTACHMENT); const Texture2D &depth = target[j]->get_target_texture(DEPTH_ATTACHMENT); - postproc[i].postproc->render(renderer, color, depth); + postproc[i]->render(renderer, color, depth); } } } @@ -193,7 +178,6 @@ void Sequence::set_debug_name(const string &name) Sequence::Step::Step(Tag t, Renderable *r): tag(t), lighting(0), - clipping(0), renderable(r) { } @@ -212,15 +196,5 @@ void Sequence::Step::set_stencil_test(const StencilTest &st) stencil_test = st; } -void Sequence::Step::set_blend(const Blend &b) -{ - blend = b; -} - -void Sequence::Step::set_clipping(const Clipping *c) -{ - clipping = c; -} - } // namespace GL } // namespace Msp