]> git.tdb.fi Git - r2c2.git/commitdiff
Give vehicle types a simple box geometry
authorMikko Rasa <tdb@tdb.fi>
Tue, 25 Jun 2013 16:12:38 +0000 (19:12 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 25 Jun 2013 16:12:38 +0000 (19:12 +0300)
source/libr2c2/vehicletype.cpp
source/libr2c2/vehicletype.h

index 973070ceafc158fe2fddfd4fb966115c5c1ca2a6..854308c71ad80cd46861bfa8786021174db40dae 100644 (file)
@@ -1,4 +1,6 @@
 #include <msp/core/maputils.h>
+#include <msp/geometry/box.h>
+#include <msp/geometry/transformedshape.h>
 #include <msp/strings/format.h>
 #include "vehicletype.h"
 
@@ -120,6 +122,13 @@ VehicleType::Loader::Loader(VehicleType &vt):
        add("width",      &Loader::width);
 }
 
+void VehicleType::Loader::finish()
+{
+       obj.shape = new Geometry::TransformedShape<float, 3>(
+               Geometry::Box<float>(obj.length, obj.width, obj.height),
+               Transform::translation(Vector(0, 0, obj.height/2)));
+}
+
 void VehicleType::Loader::axle()
 {
        Axle axl;
index 841664e375f10f61b079b52a535318c79cd4ea76..145a08dec64c992ab4da7e261675711c5af3af1c 100644 (file)
@@ -18,6 +18,7 @@ public:
        public:
                Loader(VehicleType &);
        private:
+               virtual void finish();
                void axle();
                void bogie();
                void function(unsigned, const std::string &);