]> git.tdb.fi Git - r2c2.git/blob - source/3d/signal.cpp
Also check if the clock is stopped
[r2c2.git] / source / 3d / signal.cpp
1 #include <msp/gl/renderer.h>
2 #include "catalogue.h"
3 #include "layout.h"
4 #include "signal.h"
5 #include "signaltype.h"
6
7 using namespace Msp;
8
9 namespace R2C2 {
10
11 Signal3D::Signal3D(Layout3D &l, Signal &s):
12         Object3D(l, s),
13         GL::ObjectInstance(l.get_catalogue().get_3d(s.get_type()).get_object()),
14         signal(s)
15 {
16         layout.get_scene().add(*this);
17 }
18
19 Signal3D::~Signal3D()
20 {
21         layout.get_scene().remove(*this);
22 }
23
24 Vector Signal3D::get_node() const
25 {
26         return matrix*Vector(0, -0.035, 0.13);
27 }
28
29 void Signal3D::setup_render(GL::Renderer &renderer, const GL::Tag &) const
30 {
31         renderer.matrix_stack() *= matrix;
32         // XXX Use track gauge, configure signal side
33         renderer.matrix_stack() *= GL::Matrix::translation(0, -0.035, 0);
34 }
35
36 } // namespace R2C2