2 #include "simplescene.h"
7 void SimpleScene::add(Renderable &r)
9 // Add to cache as well if the cache is valid
10 if(renderables.insert(&r).second && !cache.empty())
14 void SimpleScene::remove(Renderable &r)
16 renderables.erase(&r);
20 void SimpleScene::populate_cache() const
22 if(cache.empty() && !renderables.empty())
24 cache.reserve(renderables.size());
25 cache.insert(cache.end(), renderables.begin(), renderables.end());
29 void SimpleScene::setup_frame(Renderer &renderer)
32 for(Renderable *r: cache)
33 r->setup_frame(renderer);
36 void SimpleScene::finish_frame()
38 for(Renderable *r: cache)
42 void SimpleScene::render(Renderer &renderer, Tag tag) const
45 if(setup_frustum(renderer))
47 for(Renderable *r: cache)
49 renderer.render(*r, tag);
53 for(Renderable *r: cache)
54 renderer.render(*r, tag);