mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-08-05 22:26:30 +08:00
FIX:Fixed calculation of camera's tight frustrum around box
jira:none code is from prusaSlicer , thanks prusaSlicer and enricoturri commit bf3772d68ab6f15bf9170ba363e5264d8623631c Author: enricoturri1966 <enricoturri@seznam.cz> Date: Thu Nov 9 09:55:37 2023 +0100 #11617 - Fixed calculation of camera's tight frustrum around box (SPE-2023) Change-Id: If61ab54fbeebac7fbe1a771ebd1bd8abc88071c3
This commit is contained in:
parent
4a8709cd03
commit
a4e636d1a9
@ -523,7 +523,7 @@ std::pair<double, double> Camera::calc_tight_frustrum_zs_around(const BoundingBo
|
|||||||
{
|
{
|
||||||
std::pair<double, double> ret;
|
std::pair<double, double> ret;
|
||||||
auto& [near_z, far_z] = ret;
|
auto& [near_z, far_z] = ret;
|
||||||
|
set_distance(DefaultDistance);
|
||||||
// box in eye space
|
// box in eye space
|
||||||
const BoundingBoxf3 eye_box = box.transformed(m_view_matrix);
|
const BoundingBoxf3 eye_box = box.transformed(m_view_matrix);
|
||||||
near_z = -eye_box.max(2);
|
near_z = -eye_box.max(2);
|
||||||
@ -547,15 +547,6 @@ std::pair<double, double> Camera::calc_tight_frustrum_zs_around(const BoundingBo
|
|||||||
near_z += delta;
|
near_z += delta;
|
||||||
far_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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user