]> git.tdb.fi Git - libs/gl.git/blob - source/orderedscene.h
Change Scene into an abstract base class and add a few subclasses
[libs/gl.git] / source / orderedscene.h
1 /* $Id$
2
3 This file is part of libmspgl
4 Copyright © 2010  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GL_ORDEREDSCENE_H_
9 #define MSP_GL_ORDEREDSCENE_H_
10
11 #include <list>
12 #include <msp/gl/scene.h>
13
14 namespace Msp {
15 namespace GL {
16
17 /**
18 A scene that renders its contents in a specific order.  Inserting Renderables
19 in the middle and removing them are O(N) operations.
20 */
21 class OrderedScene: public Scene
22 {
23 private:
24         typedef std::list<const Renderable *> RenderableList;
25
26         RenderableList renderables;
27
28 public:
29         virtual void add(const Renderable &);
30         virtual void remove(const Renderable &);
31         void prepend(const Renderable &);
32         void insert(unsigned, const Renderable &);
33         void insert_after(const Renderable &, const Renderable &);
34
35         virtual void render(const Tag & = Tag()) const;
36 };
37
38 } // namespace GL
39 } // namespace Msp
40
41 #endif