X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fzsortedscene.h;h=5c876697cae9ee3a878c42be2fc48156471ee9ce;hb=af0077ac71c51aeed63bc0222fe4650d5077478a;hp=f9f6f7eed40bd9cfa527540c5417c6fbce3ae75e;hpb=b345b919f572b35042d7c50291422f2f917e5a08;p=libs%2Fgl.git diff --git a/source/zsortedscene.h b/source/zsortedscene.h index f9f6f7ee..5c876697 100644 --- a/source/zsortedscene.h +++ b/source/zsortedscene.h @@ -23,25 +23,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 { + bool in_frustum; float depth; const Renderable *renderable; - 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);