aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRob Blanckaert <basicer@basicer.com>2017-10-07 09:11:48 -0400
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-10-07 15:11:48 +0200
commit3c93a56e16f03893f97b7d28b0a8a0e302cb55ca (patch)
treeb44d958848ac62e9bbd8713f5f89977fdd9dd4ec /src
parentf547452685b299712ff5aa15bf06b4cd6069deec (diff)
downloadminetest-3c93a56e16f03893f97b7d28b0a8a0e302cb55ca.tar.gz
minetest-3c93a56e16f03893f97b7d28b0a8a0e302cb55ca.tar.bz2
minetest-3c93a56e16f03893f97b7d28b0a8a0e302cb55ca.zip
Add setting for near plane distance. (#6395)
* Allow setting the near plane * - Add near_plane limit of 0.5 to prevent x-ray. - Add more details to near_plane setting.
Diffstat (limited to 'src')
-rw-r--r--src/camera.cpp2
-rw-r--r--src/defaultsettings.cpp1
2 files changed, 3 insertions, 0 deletions
diff --git a/src/camera.cpp b/src/camera.cpp
index 29ff27f8f..e0028f480 100644
--- a/src/camera.cpp
+++ b/src/camera.cpp
@@ -549,7 +549,9 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, f32 tool_r
void Camera::updateViewingRange()
{
f32 viewing_range = g_settings->getFloat("viewing_range");
+ f32 near_plane = g_settings->getFloat("near_plane");
m_draw_control.wanted_range = viewing_range;
+ m_cameranode->setNearValue(rangelim(near_plane, 0.0f, 0.5f) * BS);
if (m_draw_control.range_all) {
m_cameranode->setFarValue(100000.0);
return;
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index 3c826dd2e..58ea0c77a 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -149,6 +149,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("fps_max", "60");
settings->setDefault("pause_fps_max", "20");
settings->setDefault("viewing_range", "100");
+ settings->setDefault("near_plane", "0.1");
settings->setDefault("screen_w", "1024");
settings->setDefault("screen_h", "600");
settings->setDefault("autosave_screensize", "true");