2 #include "objectinstance.h"
3 #include "instancescene.h"
6 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
11 void InstanceScene::add(Renderable &r)
13 renderables[r.get_instance_key()].insert(&r);
16 void InstanceScene::remove(Renderable &r)
18 InstanceMap::iterator i = renderables.find(r.get_instance_key());
19 if(i!=renderables.end())
27 void InstanceScene::setup_frame(Renderer &renderer)
29 for(InstanceMap::const_iterator i=renderables.begin(); i!=renderables.end(); ++i)
30 for(RenderableSet::const_iterator j=i->second.begin(); j!=i->second.end(); ++j)
31 (*j)->setup_frame(renderer);
34 void InstanceScene::finish_frame()
36 for(InstanceMap::const_iterator i=renderables.begin(); i!=renderables.end(); ++i)
37 for(RenderableSet::const_iterator j=i->second.begin(); j!=i->second.end(); ++j)
41 void InstanceScene::render(Renderer &renderer, Tag tag) const
43 if(setup_frustum(renderer))
45 for(InstanceMap::const_iterator i=renderables.begin(); i!=renderables.end(); ++i)
46 for(RenderableSet::const_iterator j=i->second.begin(); j!=i->second.end(); ++j)
47 if(!frustum_cull(**j))
48 renderer.render(**j, tag);
52 for(InstanceMap::const_iterator i=renderables.begin(); i!=renderables.end(); ++i)
53 for(RenderableSet::const_iterator j=i->second.begin(); j!=i->second.end(); ++j)
54 renderer.render(**j, tag);