]> git.tdb.fi Git - libs/gl.git/blobdiff - source/render/sequence.cpp
Move blend state from Sequence::Step to RenderMethod
[libs/gl.git] / source / render / sequence.cpp
index 5a3afa452e2e9235ade6e0cfc6558073672fa23e..4ccf540809d4a3138f4e30e3d23a0ca3e0e35370 100644 (file)
@@ -1,10 +1,9 @@
-#include <msp/core/maputils.h>
-#include "blend.h"
+#include <msp/strings/format.h>
 #include "error.h"
-#include "framebuffer.h"
 #include "lighting.h"
 #include "postprocessor.h"
 #include "renderer.h"
+#include "rendertarget.h"
 #include "sequence.h"
 #include "texture2d.h"
 
@@ -13,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");
@@ -120,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);
@@ -130,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)
@@ -161,11 +148,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());
@@ -208,7 +193,6 @@ void Sequence::set_debug_name(const string &name)
 Sequence::Step::Step(Tag t, Renderable *r):
        tag(t),
        lighting(0),
-       clipping(0),
        renderable(r)
 { }
 
@@ -227,15 +211,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