]> git.tdb.fi Git - r2c2.git/blobdiff - source/3d/vehicle.cpp
Mark generated routes as temporary and don't show or save them
[r2c2.git] / source / 3d / vehicle.cpp
index 4fbac68c0ea36c952bbe537022315d7db383d923..41bb26259da3b2a769c7a93e427acfb76ab1fe0b 100644 (file)
@@ -11,6 +11,7 @@ Distributed under the GPL
 #include "vehicle.h"
 #include "vehicletype.h"
 
+using namespace std;
 using namespace Msp;
 
 namespace Marklin {
@@ -46,7 +47,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<VehicleType::Bogie> &bogies = vehicle.get_type().get_bogies();
+               for(unsigned i=0; i<bogies.size(); ++i)
+               {
+                       GL::PushMatrix push_mat2;
+                       GL::translate(bogies[i].position, 0, 0);
+                       float angle = vehicle.get_bogie_direction(i)*180/M_PI;
+                       if(bogies[i].rotate_object)
+                               angle += 180;
+                       GL::rotate(angle, 0, 0, 1);
+                       if(type.get_bogie_object(i))
+                               type.get_bogie_object(i)->render(tag);
+               }
        }
 }