#include <set>
#include <vector>
-#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
entirely occluded by others.
private:
struct OccludedRenderable
{
- Renderable *renderable;
- const Geometry::BoundingSphere<float, 3> *bounding_sphere;
- bool in_frustum;
- bool occluder;
- unsigned query;
-
- 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;
- std::set<Renderable *> renderables;
- float occluder_min_size;
+ Blend no_color_write;
+ DepthTest no_depth_write = { LEQUAL, false };
+ std::vector<Renderable *> renderables;
+ 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();
- ~OccludedScene();
virtual void add(Renderable &);
virtual void remove(Renderable &);