]> git.tdb.fi Git - libs/gl.git/blob - source/scene.h
Add a Scene type that sorts its renderables by depth
[libs/gl.git] / source / scene.h
1 #ifndef MSP_GL_SCENE_H_
2 #define MSP_GL_SCENE_H_
3
4 #include "renderable.h"
5
6 namespace Msp {
7 namespace GL {
8
9 class Culler;
10
11 /**
12 Scenes are containers for other Renderables.  This is a base class that can't
13 be instantiated.  Examples of available Scene types are SimpleScene,
14 InstancedScene and OrderedScene.
15 */
16 class Scene: public Renderable
17 {
18 protected:
19         std::list<Culler *> cullers;
20
21         Scene() { }
22 public:
23         virtual ~Scene() { }
24
25         virtual void add(const Renderable &) = 0;
26         virtual void remove(const Renderable &) = 0;
27
28         void add_culler(Culler &);
29         void remove_culler(Culler &);
30
31         using Renderable::render;
32         virtual void render(const Tag & = Tag()) const;
33
34 protected:
35         virtual void setup_cullers(const Renderer &) const;
36         virtual bool cull(const Renderer &, const Renderable &) const;
37 };
38
39 } // namespace GL
40 } // namespace Msp
41
42 #endif