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 Top-level content class. Typically a Pipeline is used as the content
24 Renderable for a View or effects such as ShadowMap or EnvironmentMap.
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.
30 PostProcessors can be applied after all of the passes in the Pipeline have been
31 rendered. Framebuffer objects are automatically used to pass render results to
32 the PostProcessors. High dynamic range and multisample rendering can be
33 requested for increased quality.
35 class Pipeline: public Renderable
42 const Lighting *lighting;
43 const DepthTest *depth_test;
45 const Clipping *clipping;
46 Renderable *renderable;
49 Pass(const Tag &, Renderable *);
51 const Tag &get_tag() const { return tag; }
53 void set_lighting(const Lighting *);
54 void set_depth_test(const DepthTest *);
55 void set_blend(const Blend *);
56 void set_clipping(const Clipping *);
57 const Lighting *get_lighting() const { return lighting; }
58 const DepthTest *get_depth_test() const { return depth_test; }
59 const Blend *get_blend() const { return blend; }
60 const Clipping *get_clipping() const { return clipping; }
61 Renderable *get_renderable() const { return renderable; }
67 Renderable *renderable;
73 typedef std::list<Pass> PassList;
77 std::vector<Slot> renderables;
78 std::vector<PostProcessor *> postproc;
83 RenderTarget *target[2];
84 RenderTarget *target_ms;
87 Pipeline(unsigned, unsigned, bool = false);
90 /* Sets high dynamic range mode. Requires floating-point texture support.
91 A ColorCurve postprocessor is recommended for full benefit. */
94 void set_multisample(unsigned);
97 void set_camera(const Camera *);
98 Pass &add_pass(const Tag &tag);
99 void add_renderable(Renderable &);
100 void add_renderable_for_pass(Renderable &, const Tag &);
101 void remove_renderable(Renderable &);
103 /** Adds a pass to the pipeline. It's permissible to add the same
104 Renderable multiple times. */
105 Pass &add_pass(const Tag &, Renderable &);
107 /** Adds a postprocessor to the pipeline. */
108 void add_postprocessor(PostProcessor &);
110 virtual void setup_frame(Renderer &);
111 virtual void finish_frame();
114 virtual void render(Renderer &, const Tag &tag = Tag()) const;
117 void create_targets(unsigned);