This is a quick and dirty solution to support multiple units. A better
solution is to allow rotating the vehicle instance, but that needs some
additional coding to handle correctly.
GL::Matrix matrix;
const Vector &pos = vehicle.get_position();
matrix.translate(pos.x, pos.y, pos.z);
GL::Matrix matrix;
const Vector &pos = vehicle.get_position();
matrix.translate(pos.x, pos.y, pos.z);
- matrix.rotate(vehicle.get_direction(), 0, 0, 1);
+ float dir = vehicle.get_direction();
+ if(vehicle.get_type().get_rotate_object())
+ dir += M_PI;
+ matrix.rotate(dir, 0, 0, 1);
renderer.matrix_stack() *= matrix;
}
renderer.matrix_stack() *= matrix;
}
swap_direction(false),
length(0),
width(0),
swap_direction(false),
length(0),
width(0),
+ height(0),
+ rotate_object(false)
{ }
unsigned VehicleType::get_max_function() const
{ }
unsigned VehicleType::get_max_function() const
add("name", &VehicleType::name);
add("object", &VehicleType::object);
add("rod", &Loader::rod);
add("name", &VehicleType::name);
add("object", &VehicleType::object);
add("rod", &Loader::rod);
+ add("rotate_object", &VehicleType::rotate_object);
add("swap_direction", &VehicleType::swap_direction);
add("width", &Loader::width);
}
add("swap_direction", &VehicleType::swap_direction);
add("width", &Loader::width);
}
BogieArray bogies;
RodArray rods;
std::string object;
BogieArray bogies;
RodArray rods;
std::string object;
public:
VehicleType(const ArticleNumber &);
public:
VehicleType(const ArticleNumber &);
float get_front_axle_offset() const;
float get_back_axle_offset() const;
const std::string &get_object() const { return object; }
float get_front_axle_offset() const;
float get_back_axle_offset() const;
const std::string &get_object() const { return object; }
+ bool get_rotate_object() const { return rotate_object; }