1 #ifndef MSP_GL_OCCLUDEDSCENE_H_
2 #define MSP_GL_OCCLUDEDSCENE_H_
14 A scene that performs occlusion queries on renderables to skip those that are
15 entirely occluded by others.
17 class OccludedScene: public Scene
20 struct OccludedRenderable
22 Renderable *renderable;
23 const Geometry::BoundingSphere<float, 3> *bounding_sphere;
31 typedef std::set<Renderable *> RenderableSet;
32 typedef std::vector<OccludedRenderable> OccludedArray;
34 const Mesh &bounding_mesh;
35 const Program &bounding_shader;
36 RenderableSet renderables;
37 float occluder_min_size;
38 mutable OccludedArray occluded_cache;
39 mutable bool cache_dirty;
42 OccludedScene(Resources &);
45 virtual void add(Renderable &);
46 virtual void remove(Renderable &);
49 void populate_cache() const;
52 virtual void setup_frame(Renderer &);
53 virtual void finish_frame();
55 virtual void render(Renderer &, const Tag & = Tag()) const;