]> git.tdb.fi Git - r2c2.git/blob - source/3d/layout.h
Improve graphics quality with some shaders and effects
[r2c2.git] / source / 3d / layout.h
1 #ifndef R2C2_3D_LAYOUT_H_
2 #define R2C2_3D_LAYOUT_H_
3
4 #include <sigc++/trackable.h>
5 #include <msp/gl/instancescene.h>
6 #include <msp/gl/light.h>
7 #include <msp/gl/lighting.h>
8 #include <msp/gl/simplescene.h>
9 #include "libr2c2/layout.h"
10 #include "catalogue.h"
11 #include "typemap.h"
12
13 namespace R2C2 {
14
15 class Object3D;
16 class Utility3D;
17
18 class Layout3D: public sigc::trackable
19 {
20 public:
21         typedef std::map<Object *, Object3D *> ObjectMap;
22
23 private:
24         Layout &layout;
25         Catalogue3D catalogue;
26         ObjectMap objects;
27         std::set<Utility3D *> utilities;
28         Msp::GL::InstanceScene scene;
29         Msp::GL::SimpleScene ep_scene;
30         Msp::GL::InstanceScene path_scene;
31         Msp::GL::Light sun;
32         Msp::GL::Lighting lighting;
33
34 public:
35         Layout3D(Layout &);
36         ~Layout3D();
37
38         Layout &get_layout() const { return layout; }
39         Catalogue3D &get_catalogue() { return catalogue; }
40         const Catalogue3D &get_catalogue() const { return catalogue; }
41
42         void add(Object3D &);
43         Object3D &get_3d(Object &) const;
44         const ObjectMap &get_all() const { return objects; }
45         void remove(Object3D &);
46
47         template<typename T>
48         typename TypeMap3D<T>::Type3D &get_3d(T &o) const
49         { return dynamic_cast<typename TypeMap3D<T>::Type3D &>(get_3d(static_cast<Object &>(o))); }
50
51         void add(Utility3D &);
52         void remove(Utility3D &);
53
54         Msp::GL::Scene &get_scene() { return scene; }
55         Msp::GL::Scene &get_endpoint_scene() { return ep_scene; }
56         Msp::GL::Scene &get_path_scene() { return path_scene; }
57         const Msp::GL::Light &get_sun() const { return sun; }
58         const Msp::GL::Lighting &get_lighting() const { return lighting; }
59
60         void tick();
61
62 private:
63         void object_added(Object &);
64         void object_removed(Object &);
65 };
66
67 } // namespace R2C2
68
69 #endif
70