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<VehicleType::Axle> &axles = vehicle.get_type().get_axles();
+ for(unsigned i=0; i<axles.size(); ++i)
+ if(const GL::Object *obj = type.get_axle_object(i))
+ {
+ GL::PushMatrix push_mat2;
+ GL::translate(axles[i].position, 0, axles[i].wheel_dia/2);
+ obj->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);
+
+ for(unsigned j=0; j<bogies[i].axles.size(); ++j)
+ if(const GL::Object *obj = type.get_bogie_axle_object(i, j))
+ {
+ GL::PushMatrix push_mat3;
+ GL::translate(bogies[i].axles[j].position, 0, bogies[i].axles[j].wheel_dia/2);
+ obj->render(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);
}
}
}