]> git.tdb.fi Git - libs/gl.git/blobdiff - source/instancescene.cpp
Notify Renderables about the start and end of a frame
[libs/gl.git] / source / instancescene.cpp
index fb99dda881f83ca8630a4cfcba36e42b3ca5a51a..7b0979c8f5c0923d523e09a614a5acd977914fc9 100644 (file)
@@ -1,10 +1,3 @@
-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2007-2008, 2010-2011  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #include "object.h"
 #include "objectinstance.h"
 #include "instancescene.h"
@@ -29,11 +22,25 @@ void InstanceScene::remove(const Renderable &r)
        }
 }
 
+void InstanceScene::setup_frame() const
+{
+       for(InstanceMap::const_iterator i=renderables.begin(); i!=renderables.end(); ++i)
+               for(RenderableSet::const_iterator j=i->second.begin(); j!=i->second.end(); ++j)
+                       (*j)->setup_frame();
+}
+
+void InstanceScene::finish_frame() const
+{
+       for(InstanceMap::const_iterator i=renderables.begin(); i!=renderables.end(); ++i)
+               for(RenderableSet::const_iterator j=i->second.begin(); j!=i->second.end(); ++j)
+                       (*j)->finish_frame();
+}
+
 void InstanceScene::render(Renderer &renderer, const Tag &tag) const
 {
        for(InstanceMap::const_iterator i=renderables.begin(); i!=renderables.end(); ++i)
                for(RenderableSet::const_iterator j=i->second.begin(); j!=i->second.end(); ++j)
-                       (*j)->render(renderer, tag);
+                       renderer.render(**j, tag);
 }
 
 } // namespace GL