X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Frender%2Foccludedscene.h;h=1f447c39b2efec06ea25c3e0287185d5fb92d12e;hb=9e63512930bc7dace6dc169c65161961e5dcfcf6;hp=9140d13b62624b56ab1ce7e5f022f691df4a2302;hpb=fe2fc291a4fc618425c64112c9ffd3519f0b8a3e;p=libs%2Fgl.git diff --git a/source/render/occludedscene.h b/source/render/occludedscene.h index 9140d13b..1f447c39 100644 --- a/source/render/occludedscene.h +++ b/source/render/occludedscene.h @@ -3,16 +3,23 @@ #include #include -#include "mesh.h" -#include "program.h" +#include "blend.h" +#include "depthtest.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 { @@ -22,28 +29,24 @@ public: private: struct OccludedRenderable { - Renderable *renderable; - const Geometry::BoundingSphere *bounding_sphere; - bool in_frustum; - bool occluder; - unsigned query; - - OccludedRenderable(); + Renderable *renderable = 0; + const Geometry::BoundingSphere *bounding_sphere = 0; + bool in_frustum = false; + bool occluder = false; }; - typedef std::set RenderableSet; - typedef std::vector OccludedArray; - const Mesh &bounding_mesh; const Program &bounding_shader; - RenderableSet renderables; - float occluder_min_size; - mutable OccludedArray occluded_cache; - mutable bool cache_dirty; + Blend no_color_write; + DepthTest no_depth_write = { LEQUAL, false }; + std::vector content; + float occluder_min_size = 0.25f; + mutable QueryPool queries; + mutable std::vector occluded_cache; + mutable bool cache_dirty = false; public: OccludedScene(); - ~OccludedScene(); virtual void add(Renderable &); virtual void remove(Renderable &);