]> git.tdb.fi Git - libs/gl.git/blobdiff - source/orderedscene.h
Change Scene into an abstract base class and add a few subclasses
[libs/gl.git] / source / orderedscene.h
diff --git a/source/orderedscene.h b/source/orderedscene.h
new file mode 100644 (file)
index 0000000..6bb1219
--- /dev/null
@@ -0,0 +1,41 @@
+/* $Id$
+
+This file is part of libmspgl
+Copyright © 2010  Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#ifndef MSP_GL_ORDEREDSCENE_H_
+#define MSP_GL_ORDEREDSCENE_H_
+
+#include <list>
+#include <msp/gl/scene.h>
+
+namespace Msp {
+namespace GL {
+
+/**
+A scene that renders its contents in a specific order.  Inserting Renderables
+in the middle and removing them are O(N) operations.
+*/
+class OrderedScene: public Scene
+{
+private:
+       typedef std::list<const Renderable *> RenderableList;
+
+       RenderableList renderables;
+
+public:
+       virtual void add(const Renderable &);
+       virtual void remove(const Renderable &);
+       void prepend(const Renderable &);
+       void insert(unsigned, const Renderable &);
+       void insert_after(const Renderable &, const Renderable &);
+
+       virtual void render(const Tag & = Tag()) const;
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif