1 #ifndef MSP_GL_SEQUENCE_H_
2 #define MSP_GL_SEQUENCE_H_
7 #include "frameformat.h"
8 #include "renderable.h"
9 #include "stenciltest.h"
19 Top-level content class. Typically a Sequence is used as the content
20 Renderable for a View or effects such as ShadowMap or EnvironmentMap.
22 A Sequence consists of a number of steps. Each step is defined with a
23 Renderable and a tag to render it with and may also have Lighting, DepthTest
24 and Blend states. Scenes can be used to further organize Renderables within a
27 PostProcessors can be applied after all of the steps in the Sequence have been
28 processed. Framebuffer objects are automatically used to pass render results
29 to the PostProcessors. High dynamic range and multisample rendering can be
30 requested for increased quality.
32 class Sequence: public Renderable
39 const Lighting *lighting;
41 StencilTest stencil_test;
43 Renderable *renderable;
46 Step(Tag, Renderable *);
48 Tag get_tag() const { return tag; }
50 void set_lighting(const Lighting *);
51 void set_depth_test(const DepthTest &);
52 void set_stencil_test(const StencilTest &);
53 void set_blend(const Blend &);
54 const Lighting *get_lighting() const { return lighting; }
55 const DepthTest &get_depth_test() const { return depth_test; }
56 const StencilTest &get_stencil_test() const { return stencil_test; }
57 const Blend &get_blend() const { return blend; }
58 Renderable *get_renderable() const { return renderable; }
64 PostProcessor *postproc;
67 PostProcStep(PostProcessor *pp, bool o): postproc(pp), owned(o) { }
70 std::vector<Step> steps;
71 std::vector<PostProcStep> postproc;
74 FrameFormat target_format;
75 RenderTarget *target[2] = { 0, 0 };
76 RenderTarget *target_ms = 0;
77 bool clear_enabled = false;
78 std::vector<Color> clear_colors;
79 float clear_depth = 1.0f;
80 int clear_stencil = 0;
82 static Tag noclear_tag;
86 Sequence(unsigned, unsigned, const FrameFormat &);
89 unsigned get_width() const { return width; }
90 unsigned get_height() const { return height; }
91 const FrameFormat &get_target_format() { return target_format; }
93 void set_clear_enabled(bool);
94 void set_clear_colors(const std::vector<Color> &);
95 void set_clear_depth(float);
96 void set_clear_stencil(int);
98 /** Adds a step to the sequence. It's permissible to add the same
99 Renderable multiple times. */
100 Step &add_step(Tag, Renderable &);
102 /** Adds a postprocessor to the sequence. */
103 void add_postprocessor(PostProcessor &);
105 /** Adds a postprocessor to the sequence, transferring ownership. The
106 postprocessor will be deleted together with with sequence. It is also
107 deleted if this call throws an exception. */
108 void add_postprocessor_owned(PostProcessor *);
111 void add_postprocessor(PostProcessor *, bool);
114 virtual void setup_frame(Renderer &);
115 virtual void finish_frame();
117 virtual void render(Renderer &, Tag tag = Tag()) const;
119 void set_debug_name(const std::string &);