*/
class SimpleScene: public Scene
{
-protected:
+private:
typedef std::set<const Renderable *> RenderableSet;
typedef std::vector<const Renderable *> RenderableArray;
for(SortedArray::iterator i=sorted_cache.begin(); i!=sorted_cache.end(); ++i)
{
i->in_frustum = (!use_frustum || !frustum_cull(*i->renderable));
- if(i->in_frustum)
+ if(!i->in_frustum)
+ continue;
+
+ if(const Matrix *matrix = i->renderable->get_matrix())
{
- if(const Matrix *model_matrix = i->renderable->get_matrix())
- {
- if(const Geometry::BoundingSphere<float, 3> *bsphere = i->renderable->get_bounding_sphere())
- i->depth = dot(*model_matrix*bsphere->get_center()-camera_pos, look_dir)+bsphere->get_radius()*radius_factor;
- else
- i->depth = dot(*model_matrix*Vector3()-camera_pos, look_dir);
- i->depth *= sign;
- }
+ if(const Geometry::BoundingSphere<float, 3> *bsphere = i->renderable->get_bounding_sphere())
+ i->depth = dot(*matrix*bsphere->get_center()-camera_pos, look_dir)+bsphere->get_radius()*radius_factor;
else
- i->depth = 0;
+ i->depth = dot(*matrix*Vector3()-camera_pos, look_dir);
+ i->depth *= sign;
}
+ else
+ i->depth = 0;
}
for(SortedArray::iterator i=sorted_cache.begin(), j=i; i!=sorted_cache.end(); ++i)
ZSortedScene::SortedRenderable::SortedRenderable(const Renderable *r):
+ renderable(r),
in_frustum(false),
- depth(0.0f),
- renderable(r)
+ depth(0.0f)
{ }
} // namespace GL
#ifndef MSP_GL_ZSORTEDSCENE_H_
#define MSP_GL_ZSORTEDSCENE_H_
-#include "simplescene.h"
+#include <set>
+#include <vector>
+#include "scene.h"
namespace Msp {
namespace GL {
private:
struct SortedRenderable
{
+ const Renderable *renderable;
bool in_frustum;
float depth;
- const Renderable *renderable;
SortedRenderable(const Renderable *);