]> git.tdb.fi Git - r2c2.git/blobdiff - source/3d/endpoint.cpp
Enable Renderer for Endpoint3D and Path3D
[r2c2.git] / source / 3d / endpoint.cpp
index 7e33ced696d92cc2abb3da7b54ddfbcaa0606ed6..440d3f7d7e8a0362fabee8f1673bd12f1662fcc3 100644 (file)
@@ -8,6 +8,7 @@ Distributed under the GPL
 #include <cmath>
 #include <msp/gl/matrix.h>
 #include <msp/gl/misc.h>
+#include <msp/gl/renderer.h>
 #include "endpoint.h"
 #include "layout.h"
 #include "track.h"
@@ -29,24 +30,25 @@ 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);
                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);
        }
 }