simple ubershader system, reflection debugging
[laserbrain_demo] / src / metascene.h
1 #ifndef METASCENE_H_
2 #define METASCENE_H_
3
4 #include <vector>
5 #include <map>
6 #include "scene.h"
7 #include "mesh.h"
8 #include "geom.h"
9 #include "audio/ovstream.h"
10 #include "datamap.h"
11
12
13 struct FlatMirror {
14         Plane plane;    // plane in local coordinates (original)
15         Plane wplane;   // world coords plane (derived, identical to plane if node == 0)
16         float reflect;
17         std::vector<Object*> objects;
18         SceneNode *node;
19
20         FlatMirror *next;
21 };
22
23
24 class MetaScene {
25 public:
26         DataMap datamap;
27
28         std::vector<Scene*> scenes;
29
30         Mesh *walk_mesh;
31         Vec3 start_pos;
32         Quat start_rot;
33
34         std::map<Scene*, void*> scndata;
35
36         FlatMirror *mirrors;
37         std::map<Object*, FlatMirror*> objmirror;
38
39         AudioStream *music;
40
41         MetaScene();
42         ~MetaScene();
43
44         bool load(const char *fname);
45         bool scene_loaded(Scene *scn);
46
47         void update(float dt);
48         void draw() const;
49
50         /* helper functions which end up calling the corresponding Scene functions
51          * for every scene
52          */
53         SceneNode *find_node(const char *name) const;
54         SceneNode *match_node(const char *qstr) const;
55         std::list<SceneNode*> match_nodes(const char *qstr) const;
56
57         Scene *extract_nodes(const char *qstr);
58
59         int calc_mirror_planes();
60 };
61
62 #endif  // METASCENE_H_