Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setting for near plane distance. #6395

Merged
merged 2 commits into from Oct 7, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions builtin/settingtypes.txt
Expand Up @@ -532,6 +532,9 @@ pause_fps_max (FPS in pause menu) int 20
# View distance in nodes.
viewing_range (Viewing range) int 100 20 4000

# Near plane distance in nodes.
Copy link
Member

@sfan5 sfan5 Sep 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a note here that you should usually not need to change this value + the example you mentioned (=0.25 on mobile devices)

near_plane (Near plane) float 0.1 0 1

# Width component of the initial window size.
screen_w (Screen width) int 1024

Expand Down
2 changes: 2 additions & 0 deletions src/camera.cpp
Expand Up @@ -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(near_plane * BS);
if (m_draw_control.range_all) {
m_cameranode->setFarValue(100000.0);
return;
Expand Down
1 change: 1 addition & 0 deletions src/defaultsettings.cpp
Expand Up @@ -157,6 +157,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");
Expand Down