]> git.tdb.fi Git - libs/gl.git/blob - source/render/simplescene.cpp
Fix handling of constants in Spir-V reflection
[libs/gl.git] / source / render / simplescene.cpp
1 #include <msp/core/algorithm.h>
2 #include "renderer.h"
3 #include "simplescene.h"
4
5 namespace Msp {
6 namespace GL {
7
8 void SimpleScene::add(Renderable &r)
9 {
10         auto i = lower_bound(content, &r);
11         if(i==content.end() || *i!=&r)
12                 content.insert(i, &r);
13 }
14
15 void SimpleScene::remove(Renderable &r)
16 {
17         auto i = find(content, &r);
18         if(i!=content.end())
19                 content.erase(i);
20 }
21
22 void SimpleScene::setup_frame(Renderer &renderer)
23 {
24         for(Renderable *r: content)
25                 r->setup_frame(renderer);
26 }
27
28 void SimpleScene::finish_frame()
29 {
30         for(Renderable *r: content)
31                 r->finish_frame();
32 }
33
34 void SimpleScene::render(Renderer &renderer, Tag tag) const
35 {
36         if(setup_frustum(renderer))
37         {
38                 for(Renderable *r: content)
39                         if(!frustum_cull(*r))
40                                 r->render(renderer, tag);
41         }
42         else
43         {
44                 for(Renderable *r: content)
45                         r->render(renderer, tag);
46         }
47 }
48
49 } // namespace GL
50 } // namespace Msp