]> git.tdb.fi Git - r2c2.git/blob - source/3d/bogie.cpp
Instantly set turnout paths when loading state
[r2c2.git] / source / 3d / bogie.cpp
1 #include "bogie.h"
2 #include "vehicle.h"
3 #include "vehicletype.h"
4
5 using namespace Msp;
6
7 namespace R2C2 {
8
9 Bogie3D::Bogie3D(const Vehicle3D &v, unsigned b):
10         VehiclePart3D(v, *v.get_type().get_bogie_object(b)),
11         bogie(vehicle.get_vehicle().get_bogie(b))
12 { }
13
14 void Bogie3D::update_matrix()
15 {
16         matrix = vehicle.Object3D::get_matrix();
17
18         matrix.translate(bogie.type->position, 0, 0);
19         Angle dir = bogie.direction;
20         if(bogie.type->rotate_object)
21                 dir += Angle::half_turn();
22         matrix.rotate(dir, 0, 0, 1);
23 }
24
25 } // namespace R2C2