]> git.tdb.fi Git - libs/gl.git/blobdiff - source/instancescene.h
Be less eager to optimize constant conditions in loops
[libs/gl.git] / source / instancescene.h
index 1f79d767ba0d69cbb48798a820e0f8900792b01b..3f345124b47d5c086c48b81326f01230586212b3 100644 (file)
@@ -1,10 +1,3 @@
-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2007-2008, 2010  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #ifndef MSP_GL_INSTANCESCENE_H_
 #define MSP_GL_INSTANCESCENE_H_
 
@@ -15,28 +8,28 @@ Distributed under the LGPL
 namespace Msp {
 namespace GL {
 
-class Object;
-class ObjectInstance;
-
 /**
-A Scene optimized for rendering ObjectInstances.  All instances of the same
-Object are rendered in one go; otherwise the rendering order is unspecified.
+A Scene optimized for rendering instanced Renderables, such as ObjectInstances.
+All Renderables with the same instance key are rendered consecutively; within
+the same key rendering order is unspecified.
 */
 class InstanceScene: public Scene
 {
 private:
-       typedef std::set<const ObjectInstance *> InstanceSet;
-       typedef std::map<const Object *, InstanceSet> ObjectMap;
-       typedef std::set<const Renderable *> RenderableSet;
+       typedef std::set<Renderable *> RenderableSet;
+       typedef std::map<long, RenderableSet> InstanceMap;
 
-       ObjectMap objects;
-       RenderableSet renderables;
+       InstanceMap renderables;
 
 public:
-       virtual void add(const Renderable &);
-       virtual void remove(const Renderable &);
+       virtual void add(Renderable &);
+       virtual void remove(Renderable &);
+
+       virtual void setup_frame(Renderer &);
+       virtual void finish_frame();
 
-       virtual void render(const Tag &tag = Tag()) const;
+       using Scene::render;
+       virtual void render(Renderer &, const Tag &tag = Tag()) const;
 };
 
 } // namespace GL