]> git.tdb.fi Git - libs/gl.git/blob - source/pipeline.h
Add a Pipeline framework for constructing complex rendering sequences
[libs/gl.git] / source / pipeline.h
1 /* $Id$
2
3 This file is part of libmspgl
4 Copyright © 2009  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GL_PIPELINE_H_
9 #define MSP_GL_PIPELINE_H_
10
11 #include <map>
12 #include "pipelinepass.h"
13 #include "renderable.h"
14
15 namespace Msp {
16 namespace GL {
17
18 class Effect;
19 class Framebuffer;
20 class PostProcessor;
21 class Renderbuffer;
22 class Texture2D;
23
24 class Pipeline: public Renderable
25 {
26 private:
27         std::map<unsigned, PipelinePass> passes;
28         std::vector<Tag> pass_order;
29         std::vector<const Renderable *> renderables;
30         std::vector<Effect *> effects;
31         std::vector<PostProcessor *> postproc;
32         unsigned width;
33         unsigned height;
34         bool hdr;
35         Framebuffer *fbo;
36         Texture2D *color_buf;
37         Renderbuffer *depth_buf;
38
39 public:
40         Pipeline(unsigned, unsigned, bool);
41         ~Pipeline();
42
43         PipelinePass &add_pass(const Tag &tag);
44         PipelinePass &get_pass(const Tag &tag);
45         const PipelinePass &get_pass(const Tag &tag) const;
46         virtual bool has_pass(const Tag &tag) const;
47
48         void add_renderable(const Renderable &);
49         void add_effect(Effect &);
50         void add_postprocessor(PostProcessor &);
51
52         virtual void render(const Tag &tag=Tag()) const;
53         void render_all() const;
54 };
55
56 } // namespace GL
57 } // namespace Msp
58
59 #endif