]> git.tdb.fi Git - r2c2.git/blob - source/3d/layout.h
Add View3D class to bundle Layout3D with a camera and a pipeline
[r2c2.git] / source / 3d / layout.h
1 /* $Id$
2
3 This file is part of R²C²
4 Copyright © 2006-2011 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef R2C2_3D_LAYOUT_H_
9 #define R2C2_3D_LAYOUT_H_
10
11 #include <sigc++/trackable.h>
12 #include <msp/gl/instancescene.h>
13 #include <msp/gl/light.h>
14 #include <msp/gl/lighting.h>
15 #include <msp/gl/simplescene.h>
16 #include "libr2c2/layout.h"
17 #include "catalogue.h"
18
19 namespace R2C2 {
20
21 class Object3D;
22 class Track3D;
23 class Vehicle3D;
24
25 class Layout3D: public sigc::trackable
26 {
27 public:
28         typedef std::map<Track *, Track3D *> TrackMap;
29         typedef std::map<Vehicle *, Vehicle3D *> VehicleMap;
30
31 private:
32         Layout &layout;
33         Catalogue3D catalogue;
34         TrackMap tracks;
35         VehicleMap vehicles;
36         Msp::GL::InstanceScene scene;
37         Msp::GL::SimpleScene ep_scene;
38         Msp::GL::InstanceScene path_scene;
39         Msp::GL::Light sun;
40         Msp::GL::Lighting lighting;
41
42 public:
43         Layout3D(Layout &);
44         ~Layout3D();
45
46         Layout &get_layout() const { return layout; }
47         const Catalogue3D &get_catalogue() const { return catalogue; }
48         void get_bounds(Vector &, Vector &) const;
49
50         void add_track(Track3D &);
51         void remove_track(Track3D &);
52         const TrackMap &get_tracks() const { return tracks; }
53         Track3D &get_track(Track &) const;
54
55         void add_vehicle(Vehicle3D &);
56         void remove_vehicle(Vehicle3D &);
57         Vehicle3D &get_vehicle(Vehicle &) const;
58
59         Msp::GL::Scene &get_scene() { return scene; }
60         Msp::GL::Scene &get_endpoint_scene() { return ep_scene; }
61         Msp::GL::Scene &get_path_scene() { return path_scene; }
62         const Msp::GL::Lighting &get_lighting() const { return lighting; }
63
64 private:
65         void track_added(Track &);
66         void track_removed(Track &);
67         void vehicle_added(Vehicle &);
68         void vehicle_removed(Vehicle &);
69 };
70
71 } // namespace R2C2
72
73 #endif
74