1 #ifndef MSP_GL_PIPELINE_H_
2 #define MSP_GL_PIPELINE_H_
6 #include "framebuffer.h"
7 #include "renderable.h"
8 #include "renderbuffer.h"
9 #include "rendertarget.h"
10 #include "texture2d.h"
23 Encapsulates all of the information used to produce a complete image in the
24 framebuffer. This is the highest level rendering class.
26 A Pipeline contains a sequence of passes. Each pass has a Renderable along
27 with Lighting, Clipping, DepthTest and Blend states. Scenes can be used to
28 organize Renderables within a pass. A Camera can be specified for the entire
31 A Pipeline is also a Renderable itself. It will only respond to the default
32 pass. The Renderables within the Pipeline will be invoked with whatever tags
33 were specified when adding them.
35 A Pipeline's render method should normally be called without a Renderer; it
36 will create one itself, using the camera specified for the Pipeline. If a
37 Renderer is passed, its camera will be used instead.
39 PostProcessors can be applied after all of the passes in the Pipeline have been
40 rendered. Framebuffer objects are automatically used to pass render results to
41 the PostProcessors. High dynamic range and multisample rendering can be
42 requested for increased quality.
44 class Pipeline: public Renderable
51 const Lighting *lighting;
52 const DepthTest *depth_test;
54 const Clipping *clipping;
55 const Renderable *renderable;
58 Pass(const Tag &, const Renderable *);
60 const Tag &get_tag() const { return tag; }
62 void set_lighting(const Lighting *);
63 void set_depth_test(const DepthTest *);
64 void set_blend(const Blend *);
65 void set_clipping(const Clipping *);
66 const Lighting *get_lighting() const { return lighting; }
67 const DepthTest *get_depth_test() const { return depth_test; }
68 const Blend *get_blend() const { return blend; }
69 const Clipping *get_clipping() const { return clipping; }
70 const Renderable *get_renderable() const { return renderable; }
76 const Renderable *renderable;
79 Slot(const Renderable *);
82 typedef std::list<Pass> PassList;
86 std::vector<Slot> renderables;
87 std::vector<PostProcessor *> postproc;
92 RenderTarget *target[2];
93 RenderTarget *target_ms;
94 mutable bool in_frame;
97 Pipeline(unsigned, unsigned, bool = false);
101 void set_multisample(unsigned);
102 void set_camera(const Camera *);
105 Pass &add_pass(const Tag &tag);
106 void add_renderable(const Renderable &);
107 void add_renderable_for_pass(const Renderable &, const Tag &);
108 void remove_renderable(const Renderable &);
110 /** Adds a pass to the pipeline. It's permissible to add the same
111 Renderable multiple times. */
112 Pass &add_pass(const Tag &, const Renderable &);
114 /** Adds a postprocessor to the pipeline. */
115 void add_postprocessor(PostProcessor &);
117 virtual void setup_frame() const;
118 virtual void finish_frame() const;
120 virtual void render(const Tag &tag = Tag()) const;
121 virtual void render(Renderer &, const Tag &tag = Tag()) const;
124 void create_targets(unsigned);