]> git.tdb.fi Git - libs/gl.git/blobdiff - source/pipeline.h
Add EXT_framebuffer_blit and EXT_framebuffer_multisample
[libs/gl.git] / source / pipeline.h
index 592c3caebebccd7d986250a8c5cc4f440880a9f6..f7f7e06ca198d84fe0a7b0aad583898f3eabd6cc 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
 
 This file is part of libmspgl
-Copyright © 2009  Mikko Rasa, Mikkosoft Productions
+Copyright © 2009-2011  Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 
@@ -9,6 +9,7 @@ Distributed under the LGPL
 #define MSP_GL_PIPELINE_H_
 
 #include <map>
+#include <set>
 #include "pipelinepass.h"
 #include "renderable.h"
 
@@ -25,25 +26,39 @@ class Texture2D;
 class Pipeline: public Renderable
 {
 private:
+       struct Slot
+       {
+               const Renderable *renderable;
+               std::set<Tag> passes;
+
+               Slot(const Renderable *);
+       };
+
        typedef std::map<Tag, PipelinePass> PassMap;
 
        PassMap passes;
        std::vector<Tag> pass_order;
        const Camera *camera;
-       std::vector<const Renderable *> renderables;
+       std::vector<Slot> renderables;
        std::vector<Effect *> effects;
        std::vector<PostProcessor *> postproc;
        unsigned width;
        unsigned height;
        bool hdr;
+       unsigned samples;
        Framebuffer *fbo;
        Texture2D *color_buf;
-       Renderbuffer *depth_buf;
+       Texture2D *depth_buf;
+       Framebuffer *fbo_ms;
+       Renderbuffer *color_buf_ms;
+       Renderbuffer *depth_buf_ms;
 
 public:
-       Pipeline(unsigned, unsigned, bool);
+       Pipeline(unsigned, unsigned, bool = false);
        ~Pipeline();
 
+       void set_hdr(bool);
+       void set_multisample(unsigned);
        void set_camera(const Camera *);
 
        PipelinePass &add_pass(const Tag &tag);
@@ -51,11 +66,16 @@ public:
        const PipelinePass &get_pass(const Tag &tag) const;
 
        void add_renderable(const Renderable &);
+       void add_renderable_for_pass(const Renderable &, const Tag &);
+       void remove_renderable(const Renderable &);
        void add_effect(Effect &);
        void add_postprocessor(PostProcessor &);
 
-       virtual void render(const Tag &tag=Tag()) const;
+       virtual void render(Renderer &, const Tag &tag = Tag()) const;
        void render_all() const;
+
+private:
+       void create_fbos();
 };
 
 } // namespace GL