3 This file is part of the MSP Märklin suite
4 Copyright © 2010 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
8 #include <msp/gl/meshbuilder.h>
9 #include <msp/gl/vector.h>
10 #include "vehicletype.h"
16 VehicleType3D::VehicleType3D(Catalogue3D &, const VehicleType &vt):
17 body_mesh((GL::NORMAL3, GL::VERTEX3))
19 GL::Vector3 corner(vt.get_length()/2, vt.get_width()/2, vt.get_height());
21 GL::MeshBuilder bld(body_mesh);
24 bld.vertex(corner.x, -corner.y, 0);
25 bld.vertex(corner.x, corner.y, 0);
26 bld.vertex(corner.x, corner.y, corner.z);
27 bld.vertex(corner.x, -corner.y, corner.z);
29 bld.vertex(-corner.x, corner.y, 0);
30 bld.vertex(-corner.x, -corner.y, 0);
31 bld.vertex(-corner.x, -corner.y, corner.z);
32 bld.vertex(-corner.x, corner.y, corner.z);
34 bld.vertex(corner.x, corner.y, 0);
35 bld.vertex(-corner.x, corner.y, 0);
36 bld.vertex(-corner.x, corner.y, corner.z);
37 bld.vertex(corner.x, corner.y, corner.z);
39 bld.vertex(-corner.x, -corner.y, 0);
40 bld.vertex(corner.x, -corner.y, 0);
41 bld.vertex(corner.x, -corner.y, corner.z);
42 bld.vertex(-corner.x, -corner.y, corner.z);
44 bld.vertex(-corner.x, -corner.y, corner.z);
45 bld.vertex(corner.x, -corner.y, corner.z);
46 bld.vertex(corner.x, corner.y, corner.z);
47 bld.vertex(-corner.x, corner.y, corner.z);
51 } // namespace Marklin