X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fzsortedscene.h;h=b032cbcdf01f08e228846aebb32b3c5b96c60d37;hb=3b159edbe4e80a2bc19c4c2fcd42cb996b9fbfe0;hp=f9f6f7eed40bd9cfa527540c5417c6fbce3ae75e;hpb=c87860db3b23a98eda1adfe59acddffdb6eb8420;p=libs%2Fgl.git diff --git a/source/zsortedscene.h b/source/zsortedscene.h index f9f6f7ee..b032cbcd 100644 --- a/source/zsortedscene.h +++ b/source/zsortedscene.h @@ -1,7 +1,9 @@ #ifndef MSP_GL_ZSORTEDSCENE_H_ #define MSP_GL_ZSORTEDSCENE_H_ -#include "simplescene.h" +#include +#include +#include "scene.h" namespace Msp { namespace GL { @@ -23,25 +25,34 @@ enum DepthReference Sorts renderables by their distance from the camera before rendering. Requires renderables to have a matrix. */ -class ZSortedScene: public SimpleScene +class ZSortedScene: public Scene { private: - struct DepthRenderable + struct SortedRenderable { - float depth; const Renderable *renderable; + bool in_frustum; + float depth; - DepthRenderable(float, const Renderable *); + SortedRenderable(const Renderable *); - bool operator<(const DepthRenderable &o) const { return depth RenderableSet; + typedef std::vector SortedArray; + + RenderableSet renderables; SortOrder order; DepthReference reference; + mutable SortedArray sorted_cache; public: ZSortedScene(); + virtual void add(const Renderable &); + virtual void remove(const Renderable &); + /// Sets the sort order. Default is back to front. void set_order(SortOrder);