]> git.tdb.fi Git - libs/gl.git/blob - source/pipeline.h
Make Tag directly comparable and use it as a key in relevant maps
[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         typedef std::map<Tag, PipelinePass> PassMap;
28
29         PassMap passes;
30         std::vector<Tag> pass_order;
31         std::vector<const Renderable *> renderables;
32         std::vector<Effect *> effects;
33         std::vector<PostProcessor *> postproc;
34         unsigned width;
35         unsigned height;
36         bool hdr;
37         Framebuffer *fbo;
38         Texture2D *color_buf;
39         Renderbuffer *depth_buf;
40
41 public:
42         Pipeline(unsigned, unsigned, bool);
43         ~Pipeline();
44
45         PipelinePass &add_pass(const Tag &tag);
46         PipelinePass &get_pass(const Tag &tag);
47         const PipelinePass &get_pass(const Tag &tag) const;
48
49         void add_renderable(const Renderable &);
50         void add_effect(Effect &);
51         void add_postprocessor(PostProcessor &);
52
53         virtual void render(const Tag &tag=Tag()) const;
54         void render_all() const;
55 };
56
57 } // namespace GL
58 } // namespace Msp
59
60 #endif