]> git.tdb.fi Git - r2c2.git/blob - source/3d/layout.h
5964a04ed4ce0b1d8a6b43dc47170215ca146f8f
[r2c2.git] / source / 3d / layout.h
1 /* $Id$
2
3 This file is part of R²C²
4 Copyright © 2006-2010 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/simplescene.h>
13 #include "libr2c2/layout.h"
14 #include "catalogue.h"
15
16 namespace R2C2 {
17
18 class Track3D;
19 class Vehicle3D;
20
21 class Layout3D: public sigc::trackable
22 {
23 public:
24         typedef std::map<Track *, Track3D *> TrackMap;
25         typedef std::map<Vehicle *, Vehicle3D *> VehicleMap;
26
27 private:
28         Layout &layout;
29         Catalogue3D catalogue;
30         TrackMap tracks;
31         VehicleMap vehicles;
32         Msp::GL::SimpleScene scene;
33         Msp::GL::SimpleScene ep_scene;
34         Msp::GL::SimpleScene path_scene;
35
36 public:
37         Layout3D(Layout &);
38         ~Layout3D();
39
40         const Catalogue3D &get_catalogue() const { return catalogue; }
41
42         void add_track(Track3D &);
43         void remove_track(Track3D &);
44         const TrackMap &get_tracks() const { return tracks; }
45         Track3D &get_track(Track &) const;
46         Track3D *pick_track(float, float, float) const;
47
48         void add_vehicle(Vehicle3D &);
49         void remove_vehicle(Vehicle3D &);
50         Vehicle3D &get_vehicle(Vehicle &) const;
51
52         Msp::GL::Scene &get_scene() { return scene; }
53         Msp::GL::Scene &get_endpoint_scene() { return ep_scene; }
54         Msp::GL::Scene &get_path_scene() { return path_scene; }
55
56 private:
57         void track_added(Track &);
58         void track_removed(Track &);
59         void vehicle_added(Vehicle &);
60         void vehicle_removed(Vehicle &);
61 };
62
63 } // namespace R2C2
64
65 #endif
66