]> git.tdb.fi Git - libs/gl.git/blob - source/instancescene.h
Drop Id tags and copyright notices from files
[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<const Renderable *> RenderableSet;
20         typedef std::map<long, RenderableSet> InstanceMap;
21
22         InstanceMap renderables;
23
24 public:
25         virtual void add(const Renderable &);
26         virtual void remove(const Renderable &);
27
28         using Scene::render;
29         virtual void render(Renderer &, const Tag &tag = Tag()) const;
30 };
31
32 } // namespace GL
33 } // namespace Msp
34
35 #endif