1 #ifndef MSP_GL_SEQUENCE_H_
2 #define MSP_GL_SEQUENCE_H_
7 #include "frameformat.h"
8 #include "renderable.h"
9 #include "stenciltest.h"
20 Top-level content class. Typically a Sequence is used as the content
21 Renderable for a View or effects such as ShadowMap or EnvironmentMap.
23 A Sequence consists of a number of steps. Each step is defined with a
24 Renderable and a tag to render it with and may also have Lighting, Clipping,
25 DepthTest and Blend states. Scenes can be used to further organize Renderables
28 PostProcessors can be applied after all of the steps in the Sequence have been
29 processed. Framebuffer objects are automatically used to pass render results
30 to the PostProcessors. High dynamic range and multisample rendering can be
31 requested for increased quality.
33 class Sequence: public Renderable
40 const Lighting *lighting;
42 StencilTest stencil_test;
44 const Clipping *clipping;
45 Renderable *renderable;
48 Step(Tag, Renderable *);
50 Tag get_tag() const { return tag; }
52 void set_lighting(const Lighting *);
53 void set_depth_test(const DepthTest &);
54 void set_stencil_test(const StencilTest &);
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 StencilTest &get_stencil_test() const { return stencil_test; }
60 const Blend &get_blend() const { return blend; }
61 const Clipping *get_clipping() const { return clipping; }
62 Renderable *get_renderable() const { return renderable; }
68 PostProcessor *postproc;
71 PostProcStep(PostProcessor *pp, bool o): postproc(pp), owned(o) { }
74 std::vector<Step> steps;
75 std::vector<PostProcStep> postproc;
78 FrameFormat target_format;
79 RenderTarget *target[2];
80 RenderTarget *target_ms;
82 std::vector<Color> clear_colors;
88 Sequence(unsigned, unsigned, const FrameFormat &);
91 unsigned get_width() const { return width; }
92 unsigned get_height() const { return height; }
93 const FrameFormat &get_target_format() { return target_format; }
95 void set_clear_enabled(bool);
96 void set_clear_colors(const std::vector<Color> &);
97 void set_clear_depth(float);
98 void set_clear_stencil(int);
100 /** Adds a step to the sequence. It's permissible to add the same
101 Renderable multiple times. */
102 Step &add_step(Tag, Renderable &);
104 /** Adds a postprocessor to the sequence. */
105 void add_postprocessor(PostProcessor &);
107 /** Adds a postprocessor to the sequence, transferring ownership. The
108 postprocessor will be deleted together with with sequence. It is also
109 deleted if this call throws an exception. */
110 void add_postprocessor_owned(PostProcessor *);
113 void add_postprocessor(PostProcessor *, bool);
116 virtual void setup_frame(Renderer &);
117 virtual void finish_frame();
119 virtual void render(Renderer &, Tag tag = Tag()) const;
121 void set_debug_name(const std::string &);