X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2F3d%2Flayout.cpp;h=0b457559f92d7bd8c532c1273a619606a613f225;hb=bc2b44d50fb144f0f2ddaecc187607d6967e2ffb;hp=72e5052e6689c5f2058b83b5d9e03c75098bf895;hpb=5116fff210cdc3f0fbdae13046cc60450aad5e8f;p=r2c2.git diff --git a/source/3d/layout.cpp b/source/3d/layout.cpp index 72e5052..0b45755 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" @@ -15,7 +16,9 @@ Layout3D::Layout3D(Layout &l): catalogue(layout.get_catalogue()) { // South, 15° from zenith - sun.set_position(0, -0.259, 0.966, 0); + sun.set_position(GL::Vector4(0, -0.259, 0.966, 0)); + sun.set_diffuse(GL::Color(0.9)); + lighting.set_ambient(GL::Color(0.4)); lighting.attach(0, sun); layout.signal_object_added.connect(sigc::mem_fun(this, &Layout3D::object_added)); @@ -34,23 +37,12 @@ Layout3D::~Layout3D() delete objects.begin()->second; } -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(); - - minp = bbox.get_minimum_point(); - maxp = bbox.get_maximum_point(); -} - 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); } @@ -80,6 +72,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)