]> git.tdb.fi Git - libs/gl.git/blob - source/simplescene.h
Remove dynamic allocation from VertexFormat
[libs/gl.git] / source / simplescene.h
1 #ifndef MSP_GL_SIMPLESCENE_H_
2 #define MSP_GL_SIMPLESCENE_H_
3
4 #include <set>
5 #include "scene.h"
6
7 namespace Msp {
8 namespace GL {
9
10 /**
11 A simple yet efficient scene.  Rendering order is unspecified.
12 */
13 class SimpleScene: public Scene
14 {
15 private:
16         typedef std::set<const Renderable *> RenderableSet;
17         typedef std::vector<const Renderable *> RenderableArray;
18
19         RenderableSet renderables;
20         mutable RenderableArray cache;
21
22 public:
23         virtual void add(const Renderable &);
24         virtual void remove(const Renderable &);
25
26 private:
27         void populate_cache() const;
28
29 public:
30         virtual void setup_frame() const;
31         virtual void finish_frame() const;
32
33         using Scene::render;
34         virtual void render(Renderer &, const Tag & = Tag()) const;
35 };
36
37 } // namespace GL
38 } // namespace Msp
39
40 #endif