-#ifndef MSP_GL_ZSORTEDSCENE_H_
-#define MSP_GL_ZSORTEDSCENE_H_
-
-#include <set>
-#include <vector>
-#include "scene.h"
-
-namespace Msp {
-namespace GL {
-
-enum SortOrder
-{
- FRONT_TO_BACK,
- BACK_TO_FRONT
-};
-
-enum DepthReference
-{
- CLOSEST,
- CENTER,
- FURTHEST
-};
-
-/**
-Sorts renderables by their distance from the camera before rendering. Requires
-renderables to have a matrix.
-*/
-class ZSortedScene: public Scene
-{
-private:
- struct SortedRenderable
- {
- const Renderable *renderable;
- bool in_frustum;
- float depth;
-
- SortedRenderable(const Renderable *);
-
- bool operator<(const SortedRenderable &o) const { return depth<o.depth; }
- };
-
- typedef std::set<const Renderable *> RenderableSet;
- typedef std::vector<SortedRenderable> 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);
-
- /// Sets the reference point for sorting. Default is furthest from camera.
- void set_reference(DepthReference);
-
- virtual void render(Renderer &, const Tag &) const;
-};
-
-} // namespace GL
-} // namespace Msp
-
-#endif