X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2F3d%2Fpath.cpp;h=1a1a16ba92902f3fcd0db9f41deae4f6243d20d2;hb=a72309e64614bb1e230f9842d94dc261be1301e6;hp=e4e0b92989172a64780753af467a80e8f90d9cf3;hpb=1ff06c5bc46a677fa389ef86c6b26664368f1653;p=r2c2.git diff --git a/source/3d/path.cpp b/source/3d/path.cpp index e4e0b92..1a1a16b 100644 --- a/source/3d/path.cpp +++ b/source/3d/path.cpp @@ -1,11 +1,12 @@ /* $Id$ This file is part of R²C² -Copyright © 2010 Mikkosoft Productions, Mikko Rasa +Copyright © 2010-2011 Mikkosoft Productions, Mikko Rasa Distributed under the GPL */ #include +#include #include "libr2c2/tracktype.h" #include "layout.h" #include "path.h" @@ -61,7 +62,12 @@ void Path3D::set_layer(float l) z_offs = l*track.get_track().get_layout().get_catalogue().get_gauge()*0.01; } -void Path3D::render(const GL::Tag &tag) const +long Path3D::get_instance_key() const +{ + return reinterpret_cast(&track.get_type()); +} + +void Path3D::render(GL::Renderer &renderer, const GL::Tag &tag) const { if(tag=="unlit") { @@ -70,14 +76,15 @@ void Path3D::render(const GL::Tag &tag) const if(!mask) return; - GL::PushMatrix push_mat; - track.apply_matrix(); - GL::translate(0, 0, z_offs); + GL::MatrixStack::Push push_mtx(renderer.matrix_stack()); + GL::Matrix matrix = track.get_matrix(); + matrix.translate(0, 0, z_offs); + renderer.matrix_stack() *= matrix; glColor4f(color.r, color.g, color.b, color.a); for(unsigned i=0; mask; ++i, mask>>=1) if(mask&1) - track.get_type().get_path_mesh(i).draw(); + track.get_type().get_path_mesh(i).draw(renderer); } }