X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2F3d%2Flayout.cpp;h=fdb4dfc24d5477672ae6fd361f989880dcc5659a;hb=d6816c177ee8d5f5191e833dce8e3c4e7e0222bf;hp=fe3514f4cd29437627cd1f213833e6e2f759a3ff;hpb=5fa009f4af8d0a2e4f52929e1ee29f5c93986ab6;p=r2c2.git diff --git a/source/3d/layout.cpp b/source/3d/layout.cpp index fe3514f..fdb4dfc 100644 --- a/source/3d/layout.cpp +++ b/source/3d/layout.cpp @@ -1,6 +1,7 @@ #include "beamgate.h" #include "layout.h" #include "signal.h" +#include "terrain.h" #include "track.h" #include "utility.h" #include "vehicle.h" @@ -41,7 +42,11 @@ void Layout3D::get_bounds(Vector &minp, Vector &maxp) const Geometry::BoundingBox bbox; for(ObjectMap::const_iterator i=objects.begin(); i!=objects.end(); ++i) - bbox = bbox|i->second->get_object().get_type().get_shape()->get_axis_aligned_bounding_box(); + { + const Shape *shape = i->second->get_object().get_shape(); + if(shape) + bbox = bbox|shape->get_axis_aligned_bounding_box(); + } minp = bbox.get_minimum_point(); maxp = bbox.get_maximum_point(); @@ -52,7 +57,7 @@ void Layout3D::add(Object3D &o) insert_unique(objects, &o.get_object(), &o); } -Object3D &Layout3D::get(Object &o) const +Object3D &Layout3D::get_3d(Object &o) const { return *get_item(objects, &o); } @@ -82,6 +87,8 @@ void Layout3D::object_added(Object &o) new Vehicle3D(*this, *v); else if(BeamGate *g = dynamic_cast(&o)) new BeamGate3D(*this, *g); + else if(Terrain *r = dynamic_cast(&o)) + new Terrain3D(*this, *r); } void Layout3D::object_removed(Object &o)