diff options
author | ANAND <ClobberXD@gmail.com> | 2020-03-29 02:23:55 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-28 21:53:55 +0100 |
commit | 13b228513e5bafafb78924cf301dae873d5d93f6 (patch) | |
tree | a76791ec8d233365b6dd8154a9f840c10c10b915 /src | |
parent | c6d6358b9283718bda1963f6f0b3b4363d477477 (diff) | |
download | minetest-13b228513e5bafafb78924cf301dae873d5d93f6.tar.gz minetest-13b228513e5bafafb78924cf301dae873d5d93f6.tar.bz2 minetest-13b228513e5bafafb78924cf301dae873d5d93f6.zip |
Ignore near_plane setting on non-Android platforms (#8749)
Camera's near-plane will be hard-coded to 0.1 on all non-Android platforms. The upper-bound of this setting has been reduced to 0.25, as 0.5 is just way too high.
Diffstat (limited to 'src')
-rw-r--r-- | src/client/camera.cpp | 13 | ||||
-rw-r--r-- | src/defaultsettings.cpp | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/client/camera.cpp b/src/client/camera.cpp index 7062e4531..871ea709d 100644 --- a/src/client/camera.cpp +++ b/src/client/camera.cpp @@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "camera.h" #include "debug.h" #include "client.h" +#include "config.h" #include "map.h" #include "clientmap.h" // MapDrawControl #include "player.h" @@ -569,10 +570,16 @@ 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"); + + // Ignore near_plane setting on all other platforms to prevent abuse +#if ENABLE_GLES + m_cameranode->setNearValue(rangelim( + g_settings->getFloat("near_plane"), 0.0f, 0.25f) * BS); +#else + m_cameranode->setNearValue(0.1f * BS); +#endif m_draw_control.wanted_range = std::fmin(adjustDist(viewing_range, getFovMax()), 4000); - m_cameranode->setNearValue(rangelim(near_plane, 0.0f, 0.5f) * BS); if (m_draw_control.range_all) { m_cameranode->setFarValue(100000.0); return; @@ -600,7 +607,7 @@ void Camera::wield(const ItemStack &item) void Camera::drawWieldedTool(irr::core::matrix4* translation) { - // Clear Z buffer so that the wielded tool stay in front of world geometry + // Clear Z buffer so that the wielded tool stays in front of world geometry m_wieldmgr->getVideoDriver()->clearZBuffer(); // Draw the wielded node (in a separate scene manager) diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index b6e385a90..472522bf4 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -165,7 +165,9 @@ void set_default_settings(Settings *settings) settings->setDefault("fps_max", "60"); settings->setDefault("pause_fps_max", "20"); settings->setDefault("viewing_range", "100"); +#if ENABLE_GLES settings->setDefault("near_plane", "0.1"); +#endif settings->setDefault("screen_w", "1024"); settings->setDefault("screen_h", "600"); settings->setDefault("autosave_screensize", "true"); |