]> git.tdb.fi Git - libs/gl.git/blobdiff - source/instancescene.cpp
Add a rendering supervisor class
[libs/gl.git] / source / instancescene.cpp
index e3e63767243a1a88ba1ea98655bb480b6ad4584b..adaebbba3ef364b34522df0a49dad2802c990b2f 100644 (file)
@@ -1,13 +1,14 @@
 /* $Id$
 
 This file is part of libmspgl
-Copyright © 2007-2008, 2010  Mikko Rasa, Mikkosoft Productions
+Copyright © 2007-2008, 2010-2011  Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 
 #include "object.h"
 #include "objectinstance.h"
 #include "instancescene.h"
+#include "renderer.h"
 
 namespace Msp {
 namespace GL {
@@ -36,13 +37,15 @@ void InstanceScene::remove(const Renderable &r)
                renderables.erase(&r);
 }
 
-void InstanceScene::render(const Tag &tag) const
+void InstanceScene::render(Renderer &renderer, const Tag &tag) const
 {
+       // XXX Check that the object has this pass to avoid some unnecessary function calls
        for(ObjectMap::const_iterator i=objects.begin(); i!=objects.end(); ++i)
-               i->first->render(i->second.begin(), i->second.end(), tag);
+               for(InstanceSet::const_iterator j=i->second.begin(); j!=i->second.end(); ++j)
+                       (*j)->render(renderer, tag);
 
        for(RenderableSet::const_iterator i=renderables.begin(); i!=renderables.end(); ++i)
-               (*i)->render(tag);
+               (*i)->render(renderer, tag);
 }
 
 } // namespace GL