1 #ifndef MSP_GL_SEQUENCE_H_
2 #define MSP_GL_SEQUENCE_H_
6 #include "framebuffer.h"
7 #include "renderable.h"
8 #include "renderbuffer.h"
9 #include "rendertarget.h"
10 #include "texture2d.h"
24 Top-level content class. Typically a Sequence is used as the content
25 Renderable for a View or effects such as ShadowMap or EnvironmentMap.
27 A Sequence consists of a number of steps. Each step is defined with a
28 Renderable and a tag to render it with and may also have Lighting, Clipping,
29 DepthTest and Blend states. Scenes can be used to further organize Renderables
32 PostProcessors can be applied after all of the steps in the Sequence have been
33 processed. Framebuffer objects are automatically used to pass render results
34 to the PostProcessors. High dynamic range and multisample rendering can be
35 requested for increased quality.
37 class Sequence: public Renderable
44 const Lighting *lighting;
45 const DepthTest *depth_test;
47 const Clipping *clipping;
48 Renderable *renderable;
51 Step(Tag, Renderable *);
53 Tag get_tag() const { return tag; }
55 void set_lighting(const Lighting *);
56 void set_depth_test(const DepthTest *);
57 void set_blend(const Blend *);
58 void set_clipping(const Clipping *);
59 const Lighting *get_lighting() const { return lighting; }
60 const DepthTest *get_depth_test() const { return depth_test; }
61 const Blend *get_blend() const { return blend; }
62 const Clipping *get_clipping() const { return clipping; }
63 Renderable *get_renderable() const { return renderable; }
66 DEPRECATED typedef Step Pass;
71 PostProcessor *postproc;
74 PostProcStep(PostProcessor *pp, bool o): postproc(pp), owned(o) { }
77 std::vector<Step> steps;
79 std::vector<PostProcStep> postproc;
85 RenderTarget *target[2];
86 RenderTarget *target_ms;
89 Sequence(unsigned, unsigned, bool = false);
90 Sequence(const View &);
91 Sequence(const Framebuffer &);
93 void init(unsigned, unsigned);
97 /* Sets high dynamic range mode. Requires floating-point texture support.
98 A ColorCurve postprocessor is recommended for full benefit. */
101 /* Enable or disable alpha channel. When enabled, all render targets are
102 created with an RGBA pixel format instead of RGB. */
103 void set_alpha(bool);
105 void set_multisample(unsigned);
107 unsigned get_width() const { return width; }
108 unsigned get_height() const { return height; }
109 bool get_hdr() const { return hdr; }
110 unsigned get_multisample() const { return samples; }
112 /** Adds a step to the sequence. It's permissible to add the same
113 Renderable multiple times. */
114 Step &add_step(Tag, Renderable &);
116 DEPRECATED Step &add_pass(Tag t, Renderable &r) { return add_step(t, r); }
118 /** Adds a postprocessor to the sequence. */
119 void add_postprocessor(PostProcessor &);
121 /** Adds a postprocessor to the sequence, transferring ownership. The
122 postprocessor will be deleted together with with sequence. It is also
123 deleted if this call throws an exception. */
124 void add_postprocessor_owned(PostProcessor *);
127 void add_postprocessor(PostProcessor *, bool);
130 virtual void setup_frame(Renderer &);
131 virtual void finish_frame();
133 virtual void render(Renderer &, Tag tag = Tag()) const;
136 void create_targets(unsigned);