aboutsummaryrefslogtreecommitdiff
path: root/src/camera.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-03-10 18:03:40 +0200
committerPerttu Ahola <celeron55@gmail.com>2012-03-10 18:03:40 +0200
commit4547ace59aa42defb3ca0212d1ebb2e3c17e14af (patch)
tree805e338f514f50f1b41578982b71f379a2ad30f2 /src/camera.cpp
parentd74659254bc5225fbd6454a50c664cc965826ec3 (diff)
downloadminetest-4547ace59aa42defb3ca0212d1ebb2e3c17e14af.tar.gz
minetest-4547ace59aa42defb3ca0212d1ebb2e3c17e14af.tar.bz2
minetest-4547ace59aa42defb3ca0212d1ebb2e3c17e14af.zip
Make Camera::updateViewingRange more snappy in following the min/max settings
Diffstat (limited to 'src/camera.cpp')
-rw-r--r--src/camera.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/camera.cpp b/src/camera.cpp
index 83b7ccd34..041dd9de5 100644
--- a/src/camera.cpp
+++ b/src/camera.cpp
@@ -366,6 +366,16 @@ void Camera::updateViewingRange(f32 frametime_in)
f32 viewing_range_max = g_settings->getS16("viewing_range_nodes_max");
viewing_range_max = MYMAX(viewing_range_min, viewing_range_max);
+
+ // Immediately apply hard limits
+ if(m_draw_control.wanted_range < viewing_range_min)
+ m_draw_control.wanted_range = viewing_range_min;
+ if(m_draw_control.wanted_range > viewing_range_max)
+ m_draw_control.wanted_range = viewing_range_max;
+
+ // Just so big a value that everything rendered is visible
+ // Some more allowance than viewing_range_max * BS because of active objects etc.
+ m_cameranode->setFarValue(viewing_range_max * BS * 10);
f32 wanted_fps = g_settings->getFloat("wanted_fps");
wanted_fps = MYMAX(wanted_fps, 1.0);
@@ -458,11 +468,6 @@ void Camera::updateViewingRange(f32 frametime_in)
m_range_old = new_range;
m_frametime_old = frametime;
-
- // Just so big a value that everything rendered is visible
- // Some more allowance than viewing_range_max * BS because of active objects etc.
- m_cameranode->setFarValue(viewing_range_max * BS * 10);
-
}
void Camera::setDigging(s32 button)