FIX:Frustum should update when zoom changed

jira: none
Change-Id: I13bba77c19420c2bb67f4ebeaa94860a8546b44b
(cherry picked from commit 03d9c9a1b9381e9138fc56ab7d437ce0420b5dc3)
This commit is contained in:
zhou.xu 2024-09-10 11:13:32 +08:00 committed by Lane.Wei
parent 1e1221216a
commit a44b1dc038
2 changed files with 3 additions and 2 deletions

View File

@ -153,7 +153,7 @@ void Camera::update_frustum()
float eps = 0.01;
if (m_last_eye.isApprox(eye_) && m_last_center.isApprox(center_) && m_last_up.isApprox(up_)
&& abs(m_last_near - near_) < eps && abs(m_last_far - far_) < eps &&
abs(m_last_aspect - aspect_) < eps && abs(m_last_fov - fov_) < eps) {
abs(m_last_aspect - aspect_) < eps && abs(m_last_fov - fov_) < eps && abs(m_last_zoom - m_zoom) < eps) {
return;
}
m_last_eye = eye_;
@ -163,6 +163,7 @@ void Camera::update_frustum()
m_last_far = far_;
m_last_aspect = aspect_;
m_last_fov = fov_;
m_last_zoom = m_zoom;
Vec3f forward((center_ - eye_).normalized());
Vec3f side((forward.cross(up_)).normalized());
Vec3f up((side.cross(forward)).normalized());

View File

@ -58,7 +58,7 @@ private:
BoundingBoxf3 m_scene_box;
Frustum m_frustum;
Vec3f m_last_eye, m_last_center, m_last_up;
float m_last_near, m_last_far, m_last_aspect, m_last_fov;
float m_last_near, m_last_far, m_last_aspect, m_last_fov,m_last_zoom;
public:
Camera() { set_default_orientation(); }