X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2F3d%2Fendpoint.cpp;h=5b7f8104f808dee56d30304e747597c6bd121d68;hb=f8a7788cee0261babfc4c804a58515aad6dfbc3d;hp=77a8af8af9cabdabf870accafa07d8ee657152bd;hpb=0a09ce2f652314e221b88c5202795be1120c7229;p=r2c2.git diff --git a/source/3d/endpoint.cpp b/source/3d/endpoint.cpp index 77a8af8..5b7f810 100644 --- a/source/3d/endpoint.cpp +++ b/source/3d/endpoint.cpp @@ -1,20 +1,21 @@ /* $Id$ -This file is part of the MSP Märklin suite -Copyright © 2010 Mikkosoft Productions, Mikko Rasa +This file is part of R²C² +Copyright © 2010-2011 Mikkosoft Productions, Mikko Rasa Distributed under the GPL */ #include #include #include +#include #include "endpoint.h" #include "layout.h" #include "track.h" using namespace Msp; -namespace Marklin { +namespace R2C2 { Endpoint3D::Endpoint3D(const Track3D &t, unsigned i): track(t), @@ -29,25 +30,26 @@ Endpoint3D::~Endpoint3D() track.get_layout().get_endpoint_scene().remove(*this); } -void Endpoint3D::render(const GL::Tag &tag) const +void Endpoint3D::render(GL::Renderer &renderer, const GL::Tag &tag) const { if(tag=="unlit") { - Point p = track.get_track().get_endpoint_position(index); + Vector p = track.get_track().get_endpoint_position(index); float a = track.get_track().get_endpoint_direction(index)+M_PI; - GL::PushMatrix push_mat; - GL::translate(p.x, p.y, p.z); - GL::rotate(a*180/M_PI, 0, 0, 1); + GL::MatrixStack::Push push_mtx(renderer.matrix_stack()); + GL::Matrix matrix; + matrix.translate(p.x, p.y, p.z); + matrix.rotate(a, 0, 0, 1); + renderer.matrix_stack() *= matrix; - GL::set(GL_CULL_FACE, track.get_track().get_link(index)); if(track.get_track().get_link(index)) glColor4f(0.5, 0, 1, 0.5); else glColor4f(1, 0, 0.5, 0.5); - mesh.draw(); + mesh.draw(renderer); } } -} // namespace Marklin +} // namespace R2C2