X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2F3d%2Fvehicle.cpp;h=37619ebd339461f104dc0bf54aeb6fcfe71e7a67;hb=cc0ee0a5e71590960bc8cb7baee7a10ef09ce3f0;hp=4fbac68c0ea36c952bbe537022315d7db383d923;hpb=e5cd9e4fbc577036a0385c985b6b65df8218d0a2;p=r2c2.git diff --git a/source/3d/vehicle.cpp b/source/3d/vehicle.cpp index 4fbac68..37619eb 100644 --- a/source/3d/vehicle.cpp +++ b/source/3d/vehicle.cpp @@ -11,6 +11,7 @@ Distributed under the GPL #include "vehicle.h" #include "vehicletype.h" +using namespace std; using namespace Msp; namespace Marklin { @@ -36,8 +37,16 @@ Point Vehicle3D::get_node() const return Point(p.x, p.y, p.z+0.01+vehicle.get_type().get_height()); } +bool Vehicle3D::is_visible() const +{ + return vehicle.get_track(); +} + void Vehicle3D::render(const GL::Tag &tag) const { + if(!vehicle.get_track()) + return; + if(tag==0) { GL::PushMatrix push_mat; @@ -46,7 +55,21 @@ void Vehicle3D::render(const GL::Tag &tag) const GL::translate(pos.x, pos.y, pos.z+0.01); GL::rotate(vehicle.get_direction()*180/M_PI, 0, 0, 1); - type.get_body_mesh().draw(); + if(type.get_body_object()) + type.get_body_object()->render(tag); + + const vector &bogies = vehicle.get_type().get_bogies(); + for(unsigned i=0; irender(tag); + } } }