]> git.tdb.fi Git - libs/gl.git/blob - source/scene.h
Share shader data between copied RenderPasses
[libs/gl.git] / source / scene.h
1 #ifndef MSP_GL_SCENE_H_
2 #define MSP_GL_SCENE_H_
3
4 #include <list>
5 #include <msp/datafile/objectloader.h>
6 #include "matrix.h"
7 #include "renderable.h"
8 #include "vector.h"
9
10 namespace Msp {
11 namespace GL {
12
13 /**
14 Scenes are containers for other Renderables.  This is a base class that can't
15 be instantiated.  Examples of available Scene types are SimpleScene,
16 InstancedScene and OrderedScene.
17 */
18 class Scene: public Renderable
19 {
20 public:
21         class Loader: public DataFile::CollectionObjectLoader<Scene>
22         {
23         public:
24                 Loader(Scene &, Collection &);
25
26         private:
27                 void object(const std::string &);
28         };
29
30 protected:
31         std::list<Renderable *> owned_data;
32         mutable Matrix culling_matrix;
33         mutable Vector4 frustum_edges[6];
34
35         Scene() { }
36 private:
37         Scene(const Scene &);
38         Scene &operator=(const Scene &);
39 public:
40         virtual ~Scene();
41
42         virtual void add(Renderable &) = 0;
43         virtual void remove(Renderable &) = 0;
44
45 protected:
46         bool setup_frustum(const Renderer &) const;
47         bool frustum_cull(const Renderable &) const;
48 };
49
50 } // namespace GL
51 } // namespace Msp
52
53 #endif