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