]> git.tdb.fi Git - libs/gl.git/blobdiff - source/pipeline.cpp
Correctly parse consecutive *s in a comment
[libs/gl.git] / source / pipeline.cpp
index 9e2976ab69e5dc4e383c413be18c9239ac786a94..53b51d7924bc91cfeb6b8c4e84ef6cf24134061a 100644 (file)
@@ -27,6 +27,11 @@ Pipeline::Pipeline(const View &view)
        init(view.get_width(), view.get_height());
 }
 
+Pipeline::Pipeline(const Framebuffer &fbo)
+{
+       init(fbo.get_width(), fbo.get_height());
+}
+
 void Pipeline::init(unsigned w, unsigned h)
 {
        camera = 0;
@@ -136,7 +141,19 @@ Pipeline::Pass &Pipeline::add_pass(const Tag &tag, Renderable &r)
 
 void Pipeline::add_postprocessor(PostProcessor &pp)
 {
-       postproc.push_back(&pp);
+       add_postprocessor(&pp, true);
+}
+
+void Pipeline::add_postprocessor_owned(PostProcessor *pp)
+{
+       add_postprocessor(pp, false);
+}
+
+void Pipeline::add_postprocessor(PostProcessor *pp, bool keep)
+{
+       postproc.push_back(pp);
+       if(keep)
+               postproc.back().keep();
        try
        {
                create_targets(0);
@@ -180,7 +197,7 @@ void Pipeline::render(Renderer &renderer, const Tag &tag) const
                return;
 
        const Framebuffer *out_fbo = Framebuffer::current();
-       // These is a no-ops but will ensure the related state gets restored
+       // These are no-ops but will ensure the related state gets restored
        BindRestore restore_fbo(out_fbo);
        BindRestore restore_depth_test(DepthTest::current());
        BindRestore restore_blend(Blend::current());
@@ -192,7 +209,6 @@ void Pipeline::render(Renderer &renderer, const Tag &tag) const
                fbo.clear(COLOR_BUFFER_BIT|DEPTH_BUFFER_BIT);
        }
 
-
        for(PassList::const_iterator i=passes.begin(); i!=passes.end(); ++i)
        {
                if(const DepthTest *dt = i->get_depth_test())