Don't use a different setting for distant viewing distance

0.6.3
Chris Robinson 7 years ago
parent 41669467ae
commit 01dbac7b15

@ -53,7 +53,6 @@
namespace namespace
{ {
float DLRenderDistance;
float DLLandFogStart; float DLLandFogStart;
float DLLandFogEnd; float DLLandFogEnd;
float DLUnderwaterFogStart; float DLUnderwaterFogStart;
@ -231,7 +230,6 @@ namespace MWRender
mWater.reset(new Water(mRootNode, sceneRoot, mResourceSystem, mViewer->getIncrementalCompileOperation(), fallback, resourcePath)); mWater.reset(new Water(mRootNode, sceneRoot, mResourceSystem, mViewer->getIncrementalCompileOperation(), fallback, resourcePath));
DLRenderDistance = Settings::Manager::getFloat("distant viewing distance", "Camera");
DLLandFogStart = Settings::Manager::getFloat("distant land fog start", "Fog"); DLLandFogStart = Settings::Manager::getFloat("distant land fog start", "Fog");
DLLandFogEnd = Settings::Manager::getFloat("distant land fog end", "Fog"); DLLandFogEnd = Settings::Manager::getFloat("distant land fog end", "Fog");
DLUnderwaterFogStart = Settings::Manager::getFloat("distant underwater fog start", "Fog"); DLUnderwaterFogStart = Settings::Manager::getFloat("distant underwater fog start", "Fog");
@ -312,10 +310,8 @@ namespace MWRender
mFirstPersonFieldOfView = Settings::Manager::getFloat("first person field of view", "Camera"); mFirstPersonFieldOfView = Settings::Manager::getFloat("first person field of view", "Camera");
mStateUpdater->setFogEnd(mViewDistance); mStateUpdater->setFogEnd(mViewDistance);
mFarClip = mDistantTerrain ? DLRenderDistance : mViewDistance;
mRootNode->getOrCreateStateSet()->addUniform(new osg::Uniform("near", mNearClip)); mRootNode->getOrCreateStateSet()->addUniform(new osg::Uniform("near", mNearClip));
mRootNode->getOrCreateStateSet()->addUniform(new osg::Uniform("far", mFarClip)); mRootNode->getOrCreateStateSet()->addUniform(new osg::Uniform("far", mViewDistance));
mUniformNear = mRootNode->getOrCreateStateSet()->getUniform("near"); mUniformNear = mRootNode->getOrCreateStateSet()->getUniform("near");
mUniformFar = mRootNode->getOrCreateStateSet()->getUniform("far"); mUniformFar = mRootNode->getOrCreateStateSet()->getUniform("far");
@ -680,7 +676,7 @@ namespace MWRender
rttCamera->setRenderOrder(osg::Camera::PRE_RENDER); rttCamera->setRenderOrder(osg::Camera::PRE_RENDER);
rttCamera->setReferenceFrame(osg::Camera::ABSOLUTE_RF); rttCamera->setReferenceFrame(osg::Camera::ABSOLUTE_RF);
rttCamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT, osg::Camera::PIXEL_BUFFER_RTT); rttCamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT, osg::Camera::PIXEL_BUFFER_RTT);
rttCamera->setProjectionMatrixAsPerspective(mFieldOfView, w/float(h), mNearClip, mFarClip); rttCamera->setProjectionMatrixAsPerspective(mFieldOfView, w/float(h), mNearClip, mViewDistance);
rttCamera->setViewMatrix(mViewer->getCamera()->getViewMatrix()); rttCamera->setViewMatrix(mViewer->getCamera()->getViewMatrix());
rttCamera->setViewport(0, 0, w, h); rttCamera->setViewport(0, 0, w, h);
@ -945,10 +941,10 @@ namespace MWRender
float fov = mFieldOfView; float fov = mFieldOfView;
if (mFieldOfViewOverridden) if (mFieldOfViewOverridden)
fov = mFieldOfViewOverride; fov = mFieldOfViewOverride;
mViewer->getCamera()->setProjectionMatrixAsPerspective(fov, aspect, mNearClip, mFarClip); mViewer->getCamera()->setProjectionMatrixAsPerspective(fov, aspect, mNearClip, mViewDistance);
mUniformNear->set(mNearClip); mUniformNear->set(mNearClip);
mUniformFar->set(mFarClip); mUniformFar->set(mViewDistance);
} }
void RenderingManager::updateTextureFiltering() void RenderingManager::updateTextureFiltering()
@ -1008,8 +1004,6 @@ namespace MWRender
else if (it->first == "Camera" && it->second == "viewing distance") else if (it->first == "Camera" && it->second == "viewing distance")
{ {
mViewDistance = Settings::Manager::getFloat("viewing distance", "Camera"); mViewDistance = Settings::Manager::getFloat("viewing distance", "Camera");
if(!mDistantTerrain)
mFarClip = mViewDistance;
if(!mDistantFog) if(!mDistantFog)
mStateUpdater->setFogEnd(mViewDistance); mStateUpdater->setFogEnd(mViewDistance);
updateProjectionMatrix(); updateProjectionMatrix();

@ -254,7 +254,6 @@ namespace MWRender
float mNightEyeFactor; float mNightEyeFactor;
float mNearClip; float mNearClip;
float mFarClip;
float mViewDistance; float mViewDistance;
bool mDistantFog : 1; bool mDistantFog : 1;
bool mDistantTerrain : 1; bool mDistantTerrain : 1;

@ -25,10 +25,6 @@ small feature culling pixel size = 2.0
# can dramatically affect performance, see documentation for details. # can dramatically affect performance, see documentation for details.
viewing distance = 6666.0 viewing distance = 6666.0
# Maximum visible distance for distant terrain. Caution: setting this too high
# can increase the chance for Z-fighting (flickering artifacts).
distant viewing distance = 40960
# Camera field of view in degrees (e.g. 30.0 to 110.0). # Camera field of view in degrees (e.g. 30.0 to 110.0).
# Does not affect the player's hands in the first person camera. # Does not affect the player's hands in the first person camera.
field of view = 55.0 field of view = 55.0

Loading…
Cancel
Save