X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2F3d%2Fvehicle.cpp;h=8027a1999d3827ab14dad36ced4816703f070a34;hb=ce8be590703fdc0709863f0ee9695f40b6adb200;hp=37619ebd339461f104dc0bf54aeb6fcfe71e7a67;hpb=dc3b2bce73df40ea885a1960a825e5cd3a33c045;p=r2c2.git diff --git a/source/3d/vehicle.cpp b/source/3d/vehicle.cpp index 37619eb..8027a19 100644 --- a/source/3d/vehicle.cpp +++ b/source/3d/vehicle.cpp @@ -1,6 +1,6 @@ /* $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 */ @@ -14,7 +14,7 @@ Distributed under the GPL using namespace std; using namespace Msp; -namespace Marklin { +namespace R2C2 { Vehicle3D::Vehicle3D(Layout3D &l, Vehicle &v): layout(l), @@ -52,25 +52,59 @@ void Vehicle3D::render(const GL::Tag &tag) const GL::PushMatrix push_mat; const Point &pos = vehicle.get_position(); - GL::translate(pos.x, pos.y, pos.z+0.01); + GL::translate(pos.x, pos.y, pos.z); GL::rotate(vehicle.get_direction()*180/M_PI, 0, 0, 1); - if(type.get_body_object()) - type.get_body_object()->render(tag); + if(const GL::Object *obj = type.get_body_object()) + obj->render(tag); + + const vector &axles = vehicle.get_type().get_axles(); + for(unsigned i=0; irender(tag); + } const vector &bogies = vehicle.get_type().get_bogies(); for(unsigned i=0; irender(tag); + + for(unsigned j=0; jrender(tag); + } + + if(bogies[i].rotate_object) + GL::rotate(180, 0, 0, 1); + if(const GL::Object *obj = type.get_bogie_object(i)) + obj->render(tag); } + + const vector &rods = vehicle.get_type().get_rods(); + for(unsigned i=0; irender(tag); + } } } -} // namespace Marklin +} // namespace R2C2