]> git.tdb.fi Git - libs/gl.git/blob - source/instancescene.h
Make animation curve creation more generic
[libs/gl.git] / source / instancescene.h
1 #ifndef MSP_GL_INSTANCESCENE_H_
2 #define MSP_GL_INSTANCESCENE_H_
3
4 #include <map>
5 #include <set>
6 #include "scene.h"
7
8 namespace Msp {
9 namespace GL {
10
11 /**
12 A Scene optimized for rendering instanced Renderables, such as ObjectInstances.
13 All Renderables with the same instance key are rendered consecutively; within
14 the same key rendering order is unspecified.
15 */
16 class InstanceScene: public Scene
17 {
18 private:
19         typedef std::set<Renderable *> RenderableSet;
20         typedef std::map<long, RenderableSet> InstanceMap;
21
22         InstanceMap renderables;
23
24 public:
25         virtual void add(Renderable &);
26         virtual void remove(Renderable &);
27
28         virtual void setup_frame(Renderer &);
29         virtual void finish_frame();
30
31         virtual void render(Renderer &, const Tag &tag = Tag()) const;
32 };
33
34 } // namespace GL
35 } // namespace Msp
36
37 #endif