]> git.tdb.fi Git - libs/gl.git/blobdiff - source/pipeline.h
Give both color and depth buffers to postprocessors
[libs/gl.git] / source / pipeline.h
index afa9ed5ed525f1ecce5caaab550b1afcacf22c67..a63eeb5f686a2deb4cd541e60cd0b05ab0a7101a 100644 (file)
@@ -9,12 +9,14 @@ Distributed under the LGPL
 #define MSP_GL_PIPELINE_H_
 
 #include <map>
+#include <set>
 #include "pipelinepass.h"
 #include "renderable.h"
 
 namespace Msp {
 namespace GL {
 
+class Camera;
 class Effect;
 class Framebuffer;
 class PostProcessor;
@@ -24,9 +26,20 @@ class Texture2D;
 class Pipeline: public Renderable
 {
 private:
-       std::map<unsigned, PipelinePass> passes;
+       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;
-       std::vector<const Renderable *> renderables;
+       const Camera *camera;
+       std::vector<Slot> renderables;
        std::vector<Effect *> effects;
        std::vector<PostProcessor *> postproc;
        unsigned width;
@@ -34,21 +47,25 @@ private:
        bool hdr;
        Framebuffer *fbo;
        Texture2D *color_buf;
-       Renderbuffer *depth_buf;
+       Texture2D *depth_buf;
 
 public:
        Pipeline(unsigned, unsigned, bool);
        ~Pipeline();
 
+       void set_camera(const Camera *);
+
        PipelinePass &add_pass(const Tag &tag);
        PipelinePass &get_pass(const Tag &tag);
        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(const Tag &tag = Tag()) const;
        void render_all() const;
 };