3 This file is part of R²C²
4 Copyright © 2010-2011 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
9 #include <msp/gl/matrix.h>
10 #include <msp/gl/misc.h>
11 #include <msp/gl/renderer.h>
20 Endpoint3D::Endpoint3D(const Track3D &t, unsigned i):
23 mesh(track.get_layout().get_catalogue().get_endpoint_mesh())
25 track.get_layout().get_endpoint_scene().add(*this);
28 Endpoint3D::~Endpoint3D()
30 track.get_layout().get_endpoint_scene().remove(*this);
33 void Endpoint3D::render(GL::Renderer &renderer, const GL::Tag &tag) const
37 Vector p = track.get_track().get_endpoint_position(index);
38 float a = track.get_track().get_endpoint_direction(index)+M_PI;
40 GL::MatrixStack::Push push_mtx(renderer.matrix_stack());
42 matrix.translate(p.x, p.y, p.z);
43 matrix.rotate(a, 0, 0, 1);
44 renderer.matrix_stack() *= matrix;
46 if(track.get_track().get_link(index))
47 glColor4f(0.5, 0, 1, 0.5);
49 glColor4f(1, 0, 0.5, 0.5);