From 751036ff878dc8ed970a6443a94c320bae7a2e6d Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Sun, 14 Feb 2021 18:04:35 -0500 Subject: [PATCH] [3.2] Limit max zoom to 1/2 of far plane instead of 1/4 --- editor/plugins/spatial_editor_plugin.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 1f4b80a5d53..0bf92abf849 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -2215,7 +2215,7 @@ void SpatialEditorViewport::set_freelook_active(bool active_now) { void SpatialEditorViewport::scale_cursor_distance(real_t scale) { real_t min_distance = MAX(camera->get_znear() * 4, ZOOM_FREELOOK_MIN); - real_t max_distance = MIN(camera->get_zfar() / 4, ZOOM_FREELOOK_MAX); + real_t max_distance = MIN(camera->get_zfar() / 2, ZOOM_FREELOOK_MAX); if (unlikely(min_distance > max_distance)) { cursor.distance = (min_distance + max_distance) / 2; } else { @@ -2228,7 +2228,7 @@ void SpatialEditorViewport::scale_cursor_distance(real_t scale) { void SpatialEditorViewport::scale_freelook_speed(real_t scale) { real_t min_speed = MAX(camera->get_znear() * 4, ZOOM_FREELOOK_MIN); - real_t max_speed = MIN(camera->get_zfar() / 4, ZOOM_FREELOOK_MAX); + real_t max_speed = MIN(camera->get_zfar() / 2, ZOOM_FREELOOK_MAX); if (unlikely(min_speed > max_speed)) { freelook_speed = (min_speed + max_speed) / 2; } else { @@ -2716,7 +2716,7 @@ void SpatialEditorViewport::_draw() { // Show speed real_t min_speed = MAX(camera->get_znear() * 4, ZOOM_FREELOOK_MIN); - real_t max_speed = MIN(camera->get_zfar() / 4, ZOOM_FREELOOK_MAX); + real_t max_speed = MIN(camera->get_zfar() / 2, ZOOM_FREELOOK_MAX); real_t scale_length = (max_speed - min_speed); if (!Math::is_zero_approx(scale_length)) { @@ -2736,7 +2736,7 @@ void SpatialEditorViewport::_draw() { // Show zoom real_t min_distance = MAX(camera->get_znear() * 4, ZOOM_FREELOOK_MIN); - real_t max_distance = MIN(camera->get_zfar() / 4, ZOOM_FREELOOK_MAX); + real_t max_distance = MIN(camera->get_zfar() / 2, ZOOM_FREELOOK_MAX); real_t scale_length = (max_distance - min_distance); if (!Math::is_zero_approx(scale_length)) {