3 This file is part of the MSP Märklin suite
4 Copyright © 2010 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
9 #include <msp/gl/matrix.h>
10 #include <msp/gl/misc.h>
19 Endpoint3D::Endpoint3D(const Track3D &t, unsigned i):
22 mesh(track.get_layout().get_catalogue().get_endpoint_mesh())
24 track.get_layout().get_endpoint_scene().add(*this);
27 Endpoint3D::~Endpoint3D()
29 track.get_layout().get_endpoint_scene().remove(*this);
32 void Endpoint3D::render(const GL::Tag &tag) const
36 Point p = track.get_track().get_endpoint_position(index);
37 float a = track.get_track().get_endpoint_direction(index)+M_PI;
39 GL::PushMatrix push_mat;
40 GL::translate(p.x, p.y, p.z);
41 GL::rotate(a*180/M_PI, 0, 0, 1);
43 GL::set(GL_CULL_FACE, track.get_track().get_link(index));
44 if(track.get_track().get_link(index))
45 glColor4f(0.5, 0, 1, 0.5);
47 glColor4f(1, 0, 0.5, 0.5);
53 } // namespace Marklin