2 #include <msp/gl/matrix.h>
3 #include <msp/gl/misc.h>
4 #include <msp/gl/renderer.h>
13 Endpoint3D::Endpoint3D(const Track3D &t, unsigned i):
16 mesh(track.get_layout().get_catalogue().get_endpoint_mesh())
18 track.get_layout().get_endpoint_scene().add(*this);
21 Endpoint3D::~Endpoint3D()
23 track.get_layout().get_endpoint_scene().remove(*this);
26 void Endpoint3D::render(GL::Renderer &renderer, const GL::Tag &tag) const
30 Vector p = track.get_track().get_endpoint_position(index);
31 float a = track.get_track().get_endpoint_direction(index)+M_PI;
33 GL::MatrixStack::Push push_mtx(renderer.matrix_stack());
35 matrix.translate(p.x, p.y, p.z);
36 matrix.rotate(a, 0, 0, 1);
37 renderer.matrix_stack() *= matrix;
39 if(track.get_track().get_link(index))
40 glColor4f(0.5, 0, 1, 0.5);
42 glColor4f(1, 0, 0.5, 0.5);