X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2F3d%2Fpath.cpp;h=2e1521087da8e36ab10121ea512834d35fd23740;hb=dbaa67c30705a9993d2626cec588c7320f1eef17;hp=1128b67bb9d61e9b4d0995da236650257e7b90f2;hpb=90790c9a28793d31b9ea38eea2f55652a0e9297b;p=r2c2.git diff --git a/source/3d/path.cpp b/source/3d/path.cpp index 1128b67..2e15210 100644 --- a/source/3d/path.cpp +++ b/source/3d/path.cpp @@ -1,12 +1,13 @@ /* $Id$ -This file is part of the MSP Märklin suite +This file is part of R²C² Copyright © 2010 Mikkosoft Productions, Mikko Rasa Distributed under the GPL */ #include -#include "libmarklin/tracktype.h" +#include +#include "libr2c2/tracktype.h" #include "layout.h" #include "path.h" #include "track.h" @@ -14,12 +15,13 @@ Distributed under the GPL using namespace Msp; -namespace Marklin { +namespace R2C2 { Path3D::Path3D(const Track3D &t): track(t), paths(0), - automatic(true) + automatic(true), + z_offs(0) { track.get_layout().get_path_scene().add(*this); } @@ -55,23 +57,35 @@ void Path3D::set_color(const GL::Color &c) color = c; } -void Path3D::render(const GL::Tag &tag) const +void Path3D::set_layer(float l) { - if(tag==0) + z_offs = l*track.get_track().get_layout().get_catalogue().get_gauge()*0.01; +} + +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") { unsigned mask = (automatic ? 1<>=1) if(mask&1) - track.get_type().get_path_mesh(i).draw(); + track.get_type().get_path_mesh(i).draw(renderer); } } -} // namespace Marklin +} // namespace R2C2