From bf3772d68ab6f15bf9170ba363e5264d8623631c Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Thu, 9 Nov 2023 09:55:37 +0100 Subject: [PATCH] #11617 - Fixed calculation of camera's tight frustrum around box (SPE-2023) --- src/slic3r/GUI/Camera.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index 789b0f1564..62ce8ea3ac 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -373,6 +373,8 @@ std::pair Camera::calc_tight_frustrum_zs_around(const BoundingBo std::pair ret; auto& [near_z, far_z] = ret; + set_distance(DefaultDistance); + // box in eye space const BoundingBoxf3 eye_box = box.transformed(m_view_matrix); near_z = -eye_box.max.z(); @@ -396,15 +398,6 @@ std::pair Camera::calc_tight_frustrum_zs_around(const BoundingBo near_z += delta; far_z += delta; } -// The following is commented out because it causes flickering of the 3D scene GUI -// when the bounding box of the scene gets large enough -// We need to introduce some smarter code to move the camera back and forth in such case -// else if (near_z > 2.0 * FrustrumMinNearZ && m_distance > DefaultDistance) { -// float delta = m_distance - DefaultDistance; -// set_distance(DefaultDistance); -// near_z -= delta; -// far_z -= delta; -// } return ret; }