]> git.tdb.fi Git - libs/gl.git/blobdiff - source/pipeline.cpp
Associate camera and setup/finish_frame calls with View
[libs/gl.git] / source / pipeline.cpp
index a5d7436aaace7cd48074d6c6c02a9ecefda94948..4c4007233d2b9fd82cc82f9bf7cccdf0cc56f3e4 100644 (file)
@@ -21,8 +21,7 @@ Pipeline::Pipeline(unsigned w, unsigned h, bool d):
        height(h),
        hdr(d),
        samples(0),
-       target_ms(0),
-       in_frame(false)
+       target_ms(0)
 {
        target[0] = 0;
        target[1] = 0;
@@ -139,7 +138,6 @@ void Pipeline::add_postprocessor(PostProcessor &pp)
 
 void Pipeline::setup_frame() const
 {
-       in_frame = true;
        for(PassList::const_iterator i=passes.begin(); i!=passes.end(); ++i)
                if(const Renderable *renderable = i->get_renderable())
                        renderable->setup_frame();
@@ -149,7 +147,6 @@ void Pipeline::setup_frame() const
 
 void Pipeline::finish_frame() const
 {
-       in_frame = false;
        for(PassList::const_iterator i=passes.begin(); i!=passes.end(); ++i)
                if(const Renderable *renderable = i->get_renderable())
                        renderable->finish_frame();
@@ -163,7 +160,9 @@ void Pipeline::render(const Tag &tag) const
                return;
 
        Renderer renderer(camera);
+       setup_frame();
        render(renderer, tag);
+       finish_frame();
 }
 
 void Pipeline::render(Renderer &renderer, const Tag &tag) const
@@ -171,10 +170,6 @@ void Pipeline::render(Renderer &renderer, const Tag &tag) const
        if(tag.id)
                return;
 
-       bool was_in_frame = in_frame;
-       if(!in_frame)
-               setup_frame();
-
        const Framebuffer *out_fbo = Framebuffer::current();
        // These is a no-ops but will ensure the related state gets restored
        BindRestore restore_fbo(out_fbo);
@@ -232,9 +227,6 @@ void Pipeline::render(Renderer &renderer, const Tag &tag) const
                        postproc[i]->render(renderer, color, depth);
                }
        }
-
-       if(!was_in_frame)
-               finish_frame();
 }
 
 void Pipeline::create_targets(unsigned recreate)