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 "catalogue.h"
11 #include "vehicletype.h"
18 VehicleType3D::VehicleType3D(Catalogue3D &, const VehicleType &vt):
20 bogie_objects(vt.get_bogies().size())
22 body_object = get_object(vt.get_object());
24 for(unsigned i=0; i<bogie_objects.size(); ++i)
25 bogie_objects[i] = get_object(vt.get_bogies()[i].object);
28 VehicleType3D::~VehicleType3D()
30 for(map<string, GL::Object *>::iterator i=objects.begin(); i!=objects.end(); ++i)
34 const GL::Object *VehicleType3D::get_axle_object(unsigned) const
39 const GL::Object *VehicleType3D::get_bogie_object(unsigned i) const
41 if(i>=bogie_objects.size())
42 throw InvalidParameterValue("Bogie index out of range");
43 return bogie_objects[i];
46 const GL::Object *VehicleType3D::get_bogie_axle_object(unsigned, unsigned) const
51 GL::Object *VehicleType3D::get_object(const string &name)
56 GL::Object *&ptr = objects[name];
60 DataFile::load(*ptr, name);
65 } // namespace Marklin