From a4e636d1a953befc1557600a902611c5ac8cd800 Mon Sep 17 00:00:00 2001 From: "zhou.xu" Date: Thu, 19 Sep 2024 14:36:40 +0800 Subject: [PATCH] FIX:Fixed calculation of camera's tight frustrum around box jira:none code is from prusaSlicer , thanks prusaSlicer and enricoturri commit bf3772d68ab6f15bf9170ba363e5264d8623631c Author: enricoturri1966 Date: Thu Nov 9 09:55:37 2023 +0100 #11617 - Fixed calculation of camera's tight frustrum around box (SPE-2023) Change-Id: If61ab54fbeebac7fbe1a771ebd1bd8abc88071c3 --- src/slic3r/GUI/Camera.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/slic3r/GUI/Camera.cpp b/src/slic3r/GUI/Camera.cpp index 76b59ef5b..b39df1ef4 100644 --- a/src/slic3r/GUI/Camera.cpp +++ b/src/slic3r/GUI/Camera.cpp @@ -523,7 +523,7 @@ 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(2); @@ -547,15 +547,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; }