X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2F3d%2Fpath.cpp;fp=source%2F3d%2Fpath.cpp;h=2e1521087da8e36ab10121ea512834d35fd23740;hb=949b13aae247fa53579ec1cda9142ccc8755acde;hp=bd6b5b18715eb68d596d084f1d1c3daa37323cd8;hpb=4b7008978ce5b67e7e1db14b4a359e4ab1881bbd;p=r2c2.git diff --git a/source/3d/path.cpp b/source/3d/path.cpp index bd6b5b1..2e15210 100644 --- a/source/3d/path.cpp +++ b/source/3d/path.cpp @@ -6,6 +6,7 @@ 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,15 +76,15 @@ void Path3D::render(const GL::Tag &tag) const if(!mask) return; - GL::MatrixStack::Push push_mtx(GL::MatrixStack::modelview()); + GL::MatrixStack::Push push_mtx(renderer.matrix_stack()); GL::Matrix matrix = track.get_matrix(); matrix.translate(0, 0, z_offs); - GL::MatrixStack::modelview() *= matrix; + 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); } }