]> git.tdb.fi Git - r2c2.git/commitdiff
Angle must be divided by the correct type
authorMikko Rasa <tdb@tdb.fi>
Tue, 25 Jun 2013 11:59:42 +0000 (14:59 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 25 Jun 2013 11:59:42 +0000 (14:59 +0300)
source/3d/view.cpp
source/designer/cameracontroller.cpp
source/engineer/engineer.cpp

index e058be7bf5661b9fe357fd74082b963097d31e0d..017a526df71b215ca192218116f79b3fd97c7178 100644 (file)
@@ -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);
index 0679cbe2f165934f93824929c6268640100690aa..d4f828c134c16ceb3a34e6b420fc0f0c99692331 100644 (file)
@@ -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;
 }
index e92c0ae161674c1b70d967f7fad5746245b5431a..ae803c414bd18553bdbeae1c36139c25bccad83d 100644 (file)
@@ -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;