]> git.tdb.fi Git - libs/gl.git/blobdiff - source/render/sequence.cpp
Allow suppressing clear in a sequence by passing in a special tag
[libs/gl.git] / source / render / sequence.cpp
index e0c333dec2b26b679ed0b293063678b9c5b6680d..f7dea9bf617ebf1db173fec541408b0735b4989b 100644 (file)
@@ -12,24 +12,12 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Sequence::Sequence():
-       width(0),
-       height(0),
-       target{0, 0},
-       target_ms(0),
-       clear_enabled(false),
-       clear_depth(1.0f),
-       clear_stencil(0)
-{ }
+Tag Sequence::noclear_tag = "noclear";
 
 Sequence::Sequence(unsigned w, unsigned h, const FrameFormat &f):
        width(w),
        height(h),
-       target_format(f),
-       target_ms(0),
-       clear_enabled(false),
-       clear_depth(1.0f),
-       clear_stencil(0)
+       target_format(f)
 {
        if(target_format.empty())
                throw invalid_argument("Sequence::Sequence");
@@ -119,7 +107,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);
@@ -129,7 +117,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)
@@ -164,7 +152,6 @@ void Sequence::render(Renderer &renderer, Tag tag) const
 
                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());
@@ -207,7 +194,6 @@ void Sequence::set_debug_name(const string &name)
 Sequence::Step::Step(Tag t, Renderable *r):
        tag(t),
        lighting(0),
-       clipping(0),
        renderable(r)
 { }
 
@@ -231,10 +217,5 @@ void Sequence::Step::set_blend(const Blend &b)
        blend = b;
 }
 
-void Sequence::Step::set_clipping(const Clipping *c)
-{
-       clipping = c;
-}
-
 } // namespace GL
 } // namespace Msp