X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdesigner%2Fcameracontroller.cpp;h=97703206588b038c1b6ad862f0dd78d4f1f8f4a7;hb=251270c97a5e5eb8630bc1662a406255dedae90e;hp=bd7edbb530d540e73ac32296b80c6c57a3106180;hpb=61da962442ae528bba9c66fa0c09427b53a4cbe0;p=r2c2.git diff --git a/source/designer/cameracontroller.cpp b/source/designer/cameracontroller.cpp index bd7edbb..9770320 100644 --- a/source/designer/cameracontroller.cpp +++ b/source/designer/cameracontroller.cpp @@ -1,6 +1,6 @@ /* $Id$ -This file is part of the MSP Märklin suite +This file is part of R²C² Copyright © 2010 Mikkosoft Productions, Mikko Rasa Distributed under the GPL */ @@ -12,7 +12,7 @@ Distributed under the GPL using namespace std; using namespace Msp; -using namespace Marklin; +using namespace R2C2; CameraController::CameraController(Designer &d, Graphics::EventSource &es, GL::Camera &c): designer(d), @@ -46,14 +46,14 @@ void CameraController::set_look_direction(const GL::Vector3 &look) void CameraController::view_all() { - Point minp; - Point maxp; + Vector minp; + Vector maxp; const Layout3D::TrackMap &tracks = designer.get_layout_3d().get_tracks(); for(Layout3D::TrackMap::const_iterator i=tracks.begin(); i!=tracks.end(); ++i) { - Point tmin; - Point tmax; + Vector tmin; + Vector tmax; i->second->get_bounds(0, tmin, tmax); minp.x = min(minp.x, tmin.x); minp.y = min(minp.y, tmin.y); @@ -83,7 +83,13 @@ void CameraController::adjust_distance(float delta) { const GL::Vector3 &pos = camera.get_position(); const GL::Vector3 &look = camera.get_look_direction(); + float dist = get_distance(); + float low = designer.get_layout().get_catalogue().get_gauge()*5; + if(dist+delta