3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
9 #include "objectinstance.h"
15 void Scene::add(const Renderable &r)
17 if(const ObjectInstance *oi = dynamic_cast<const ObjectInstance *>(&r))
18 objects[&oi->get_object()].insert(oi);
20 renderables.insert(&r);
23 void Scene::remove(const Renderable &r)
25 if(const ObjectInstance *oi = dynamic_cast<const ObjectInstance *>(&r))
27 ObjectMap::iterator i = objects.find(&oi->get_object());
36 renderables.erase(&r);
39 void Scene::render(const Tag &tag) const
41 for(ObjectMap::const_iterator i=objects.begin(); i!=objects.end(); ++i)
42 i->first->render(i->second.begin(), i->second.end(), tag);
44 for(RenderableSet::const_iterator i=renderables.begin(); i!=renderables.end(); ++i)