]> git.tdb.fi Git - libs/gl.git/blobdiff - source/render/occludedscene.h
Move WindowView::render to the backend
[libs/gl.git] / source / render / occludedscene.h
index f11c707e6781c0ea656a7676e733e3981209ea41..1f447c39b2efec06ea25c3e0287185d5fb92d12e 100644 (file)
@@ -5,17 +5,21 @@
 #include <vector>
 #include "blend.h"
 #include "depthtest.h"
-#include "mesh.h"
-#include "program.h"
 #include "query.h"
 #include "scene.h"
 
 namespace Msp {
 namespace GL {
 
+class Mesh;
+class Program;
+
 /**
-A scene that performs occlusion queries on renderables to skip those that are
+A scene which performs occlusion queries on renderables to skip those which are
 entirely occluded by others.
+
+Renderables must have valid model matrices and bounding spheres to participate
+in occlusion culling.  Those lacking one or both are always rendered.
 */
 class OccludedScene: public Scene
 {
@@ -25,23 +29,21 @@ public:
 private:
        struct OccludedRenderable
        {
-               Renderable *renderable;
-               const Geometry::BoundingSphere<float, 3> *bounding_sphere;
-               bool in_frustum;
-               bool occluder;
-
-               OccludedRenderable();
+               Renderable *renderable = 0;
+               const Geometry::BoundingSphere<float, 3> *bounding_sphere = 0;
+               bool in_frustum = false;
+               bool occluder = false;
        };
 
        const Mesh &bounding_mesh;
        const Program &bounding_shader;
        Blend no_color_write;
-       DepthTest no_depth_write;
-       std::set<Renderable *> renderables;
-       float occluder_min_size;
+       DepthTest no_depth_write = { LEQUAL, false };
+       std::vector<Renderable *> content;
+       float occluder_min_size = 0.25f;
        mutable QueryPool queries;
        mutable std::vector<OccludedRenderable> occluded_cache;
-       mutable bool cache_dirty;
+       mutable bool cache_dirty = false;
 
 public:
        OccludedScene();