Make near clip distance configurable

c++11
scrawl 10 years ago
parent c748ea7363
commit c2131e7c31

@ -132,7 +132,7 @@ namespace MWRender
osg::Camera::CullingMode cullingMode = osg::Camera::DEFAULT_CULLING|osg::Camera::FAR_PLANE_CULLING;
if (!Settings::Manager::getBool("small feature culling", "Viewing distance"))
if (!Settings::Manager::getBool("small feature culling", "Camera"))
cullingMode &= ~(osg::CullStack::SMALL_FEATURE_CULLING);
else
cullingMode |= osg::CullStack::SMALL_FEATURE_CULLING;
@ -144,7 +144,8 @@ namespace MWRender
mViewer->getCamera()->setCullMask(~(Mask_UpdateVisitor));
mViewDistance = Settings::Manager::getFloat("viewing distance", "Viewing distance");
mNearClip = Settings::Manager::getFloat("near clip", "Camera");
mViewDistance = Settings::Manager::getFloat("viewing distance", "Camera");
mFieldOfView = Settings::Manager::getFloat("field of view", "General");
updateProjectionMatrix();
}
@ -372,7 +373,7 @@ namespace MWRender
double fovy, aspect, zNear, zFar;
mViewer->getCamera()->getProjectionMatrixAsPerspective(fovy, aspect, zNear, zFar);
fovy = mFieldOfView;
zNear = 5.f;
zNear = mNearClip;
zFar = mViewDistance;
mViewer->getCamera()->setProjectionMatrixAsPerspective(fovy, aspect, zNear, zFar);
}
@ -401,9 +402,9 @@ namespace MWRender
mFieldOfView = Settings::Manager::getFloat("field of view", "General");
updateProjectionMatrix();
}
else if (it->first == "Viewing distance" && it->second == "viewing distance")
else if (it->first == "Camera" && it->second == "viewing distance")
{
mViewDistance = Settings::Manager::getFloat("viewing distance", "Viewing distance");
mViewDistance = Settings::Manager::getFloat("viewing distance", "Camera");
mStateUpdater->setFogEnd(mViewDistance);
updateProjectionMatrix();
}

@ -137,6 +137,7 @@ namespace MWRender
osg::ref_ptr<StateUpdater> mStateUpdater;
float mNearClip;
float mViewDistance;
float mFieldOfView;

@ -341,7 +341,7 @@
<Property key="Range" value="10000"/>
<Property key="Page" value="300"/>
<UserString key="SettingType" value="Slider"/>
<UserString key="SettingCategory" value="Viewing distance"/>
<UserString key="SettingCategory" value="Camera"/>
<UserString key="SettingName" value="viewing distance"/>
<UserString key="SettingValueType" value="Float"/>
<UserString key="SettingMin" value="2000"/>

@ -99,8 +99,9 @@ local map hud widget size = 256
[Cells]
exterior grid size = 3
[Viewing distance]
# Viewing distance at normal weather conditions
[Camera]
near clip = 5
# The maximum distance with no pop-in will be: (see RenderingManager::configureFog)
# viewing distance * view frustum factor <= cell size (8192) - loading threshold (1024)
# view frustum factor takes into account that the view frustum end is a plane, so at the edges of the screen you can see further than you should be able to.

Loading…
Cancel
Save