Skip to content

Commit 3c93a56

Browse files
basicernerzhul
authored andcommittedOct 7, 2017
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.
1 parent f547452 commit 3c93a56

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed
 

Diff for: ‎builtin/settingtypes.txt

+6
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,12 @@ pause_fps_max (FPS in pause menu) int 20
532532
# View distance in nodes.
533533
viewing_range (Viewing range) int 100 20 4000
534534

535+
# Camera near plane distance in nodes, between 0 and 0.5
536+
# Most users will not need to change this.
537+
# Increasing can reduce artifacting on weaker GPUs.
538+
# 0.1 = Default, 0.25 = Good value for weaker tablets.
539+
near_plane (Near plane) float 0.1 0 0.5
540+
535541
# Width component of the initial window size.
536542
screen_w (Screen width) int 1024
537543

Diff for: ‎src/camera.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,9 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, f32 tool_r
549549
void Camera::updateViewingRange()
550550
{
551551
f32 viewing_range = g_settings->getFloat("viewing_range");
552+
f32 near_plane = g_settings->getFloat("near_plane");
552553
m_draw_control.wanted_range = viewing_range;
554+
m_cameranode->setNearValue(rangelim(near_plane, 0.0f, 0.5f) * BS);
553555
if (m_draw_control.range_all) {
554556
m_cameranode->setFarValue(100000.0);
555557
return;

Diff for: ‎src/defaultsettings.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ void set_default_settings(Settings *settings)
149149
settings->setDefault("fps_max", "60");
150150
settings->setDefault("pause_fps_max", "20");
151151
settings->setDefault("viewing_range", "100");
152+
settings->setDefault("near_plane", "0.1");
152153
settings->setDefault("screen_w", "1024");
153154
settings->setDefault("screen_h", "600");
154155
settings->setDefault("autosave_screensize", "true");

0 commit comments

Comments
 (0)
Please sign in to comment.