]> git.tdb.fi Git - libs/gl.git/blob - source/effects/effect.h
d763f251bd473b7b22e58c2230400805442d2fdd
[libs/gl.git] / source / effects / effect.h
1 #ifndef MSP_GL_EFFECT_H_
2 #define MSP_GL_EFFECT_H_
3
4 #include <set>
5 #include "renderable.h"
6
7 namespace Msp {
8 namespace GL {
9
10 /**
11 Effects are used to wrap other renderables and give them additional visual
12 properties.  An Effect's render method should set up the necessary state, call
13 the wrapped Renderable's render method, and clean up after itself.
14 */
15 class Effect: public Renderable
16 {
17 protected:
18         Renderable &renderable;
19         std::set<Tag> enabled_passes;
20
21 protected:
22         Effect(Renderable &);
23 public:
24         virtual ~Effect() { }
25
26         void enable_for_pass(Tag);
27         void disable_for_pass(Tag);
28
29         virtual const Matrix *get_matrix() const { return renderable.get_matrix(); }
30         virtual const Geometry::BoundingSphere<float, 3> *get_bounding_sphere() const { return renderable.get_bounding_sphere(); }
31
32         virtual void setup_frame(Renderer &r) { renderable.setup_frame(r); }
33         virtual void finish_frame() { renderable.finish_frame(); }
34
35         virtual void set_debug_name(const std::string &) = 0;
36 };
37
38 } // namespace GL
39 } // namespace Msp
40
41 #endif