X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2F3d%2Fvehicle.cpp;h=7e4814b008b03a64b588479792959329d7254cf9;hb=f4ffb776aa0d4f51c058d27fb0f51449c05302c3;hp=41bb26259da3b2a769c7a93e427acfb76ab1fe0b;hpb=7ff28ec88dedc3a2327feb4a507ae622cb953113;p=r2c2.git diff --git a/source/3d/vehicle.cpp b/source/3d/vehicle.cpp index 41bb262..7e4814b 100644 --- a/source/3d/vehicle.cpp +++ b/source/3d/vehicle.cpp @@ -37,18 +37,35 @@ 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; 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); } } }