]> git.tdb.fi Git - libs/gl.git/blob - source/pipeline.h
Drop Id tags and copyright notices from files
[libs/gl.git] / source / pipeline.h
1 #ifndef MSP_GL_PIPELINE_H_
2 #define MSP_GL_PIPELINE_H_
3
4 #include <map>
5 #include <set>
6 #include "pipelinepass.h"
7 #include "renderable.h"
8
9 namespace Msp {
10 namespace GL {
11
12 class Camera;
13 class Effect;
14 class Framebuffer;
15 class PostProcessor;
16 class Renderbuffer;
17 class Texture2D;
18
19 class Pipeline: public Renderable
20 {
21 private:
22         struct Slot
23         {
24                 const Renderable *renderable;
25                 std::set<Tag> passes;
26
27                 Slot(const Renderable *);
28         };
29
30         typedef std::map<Tag, PipelinePass> PassMap;
31
32         PassMap passes;
33         std::vector<Tag> pass_order;
34         const Camera *camera;
35         std::vector<Slot> renderables;
36         std::vector<Effect *> effects;
37         std::vector<PostProcessor *> postproc;
38         unsigned width;
39         unsigned height;
40         bool hdr;
41         unsigned samples;
42         Framebuffer *fbo;
43         Texture2D *color_buf;
44         Texture2D *depth_buf;
45         Framebuffer *fbo_ms;
46         Renderbuffer *color_buf_ms;
47         Renderbuffer *depth_buf_ms;
48
49 public:
50         Pipeline(unsigned, unsigned, bool = false);
51         ~Pipeline();
52
53         void set_hdr(bool);
54         void set_multisample(unsigned);
55         void set_camera(const Camera *);
56
57         PipelinePass &add_pass(const Tag &tag);
58         PipelinePass &get_pass(const Tag &tag);
59         const PipelinePass &get_pass(const Tag &tag) const;
60
61         void add_renderable(const Renderable &);
62         void add_renderable_for_pass(const Renderable &, const Tag &);
63         void remove_renderable(const Renderable &);
64         void add_effect(Effect &);
65         void add_postprocessor(PostProcessor &);
66
67         virtual void render(Renderer &, const Tag &tag = Tag()) const;
68         void render_all() const;
69
70 private:
71         void create_fbos();
72 };
73
74 } // namespace GL
75 } // namespace Msp
76
77 #endif