]> git.tdb.fi Git - r2c2.git/blob - source/3d/path.h
Don't crash if a train has no router
[r2c2.git] / source / 3d / path.h
1 #ifndef R2C2_3D_PATH_H_
2 #define R2C2_3D_PATH_H_
3
4 #include <msp/gl/color.h>
5 #include <msp/gl/mesh.h>
6 #include <msp/gl/renderable.h>
7 #include "utility.h"
8
9 namespace R2C2 {
10
11 class Track3D;
12
13 class Path3D: public Utility3D, public Msp::GL::Renderable, public sigc::trackable
14 {
15 private:
16         const Track3D &track;
17         int path;
18         int side;
19         bool automatic;
20         const Msp::GL::Mesh *mesh;
21         Msp::GL::Color color;
22         float z_offs;
23
24 public:
25         Path3D(const Track3D &);
26         ~Path3D();
27
28         void set_automatic();
29         void set_path(int);
30         void set_side(int);
31         void set_color(const Msp::GL::Color &);
32         void set_layer(float);
33 private:
34         void path_changed(unsigned);
35         void update_mesh();
36
37 public:
38         virtual long get_instance_key() const;
39
40         virtual void render(Msp::GL::Renderer &, const Msp::GL::Tag &) const;
41 };
42
43 } // namespace R2C2
44
45 #endif