From: Mikko Rasa Date: Tue, 25 Jun 2013 11:59:42 +0000 (+0300) Subject: Angle must be divided by the correct type X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;ds=inline;h=1251ba0141983481181d8260523ff07f2cf200a0;p=r2c2.git Angle must be divided by the correct type --- diff --git a/source/3d/view.cpp b/source/3d/view.cpp index e058be7..017a526 100644 --- a/source/3d/view.cpp +++ b/source/3d/view.cpp @@ -36,11 +36,11 @@ void View3D::view_all(bool tight) const Vector &minp = bbox.get_minimum_point(); const Vector &maxp = bbox.get_maximum_point(); - float t = tan(camera.get_field_of_view()/2)*2; + float t = tan(camera.get_field_of_view()/2.0f)*2.0f; float size = max((maxp.y-minp.y+0.1), (maxp.x-minp.x+0.1)/camera.get_aspect()); float dist = size/t; if(!tight) - dist += sin(camera.get_field_of_view()/2)*size; + dist += sin(camera.get_field_of_view()/2.0f)*size; GL::Vector3 center = (minp+maxp)/2.0f; const GL::Vector3 &look = camera.get_look_direction(); camera.set_position(center-look*dist); diff --git a/source/designer/cameracontroller.cpp b/source/designer/cameracontroller.cpp index 0679cbe..d4f828c 100644 --- a/source/designer/cameracontroller.cpp +++ b/source/designer/cameracontroller.cpp @@ -191,6 +191,6 @@ float CameraController::get_distance() const float CameraController::get_view_scale() const { - float t = tan(camera.get_field_of_view()/2)*2; + float t = tan(camera.get_field_of_view()/2.0f)*2.0f; return get_distance()*t; } diff --git a/source/engineer/engineer.cpp b/source/engineer/engineer.cpp index e92c0ae..ae803c4 100644 --- a/source/engineer/engineer.cpp +++ b/source/engineer/engineer.cpp @@ -312,7 +312,7 @@ void Engineer::view_all() const Layout3D::TrackMap &tracks = layout_3d.get_tracks(); float view_aspect = float(window.get_width()-200)/window.get_height(); - float view_height = tan(camera.get_field_of_view()/2)*2; + float view_height = tan(camera.get_field_of_view()/2.0f)*2.0f; float best_score = 0; GL::Vector3 pos; GL::Vector3 up;