From b7859b3fa979ca7087226392cade5eaf713f86a5 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Tue, 7 Aug 2018 23:44:21 +0400 Subject: [PATCH] Cap underwater view distance (bug #4565) --- CHANGELOG.md | 1 + apps/openmw/mwrender/renderingmanager.cpp | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a28661372..17058b25e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,6 +81,7 @@ Bug #4553: Forcegreeting on non-actor opens a dialogue window which cannot be closed Bug #4557: Topics with reserved names are handled differently from vanilla Bug #4558: Mesh optimizer: check for reserved node name is case-sensitive + Bug #4565: Underwater view distance should be limited Feature #2606: Editor: Implemented (optional) case sensitive global search Feature #3083: Play animation when NPC is casting spell via script Feature #3103: Provide option for disposition to get increased by successful trade diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index f6aa8796d..03863000f 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -554,8 +554,8 @@ namespace MWRender mLandFogStart = mViewDistance * (1 - fogDepth); mLandFogEnd = mViewDistance; } - mUnderwaterFogStart = mViewDistance * (1 - underwaterFog); - mUnderwaterFogEnd = mViewDistance; + mUnderwaterFogStart = std::min(mViewDistance, 6666.f) * (1 - underwaterFog); + mUnderwaterFogEnd = std::min(mViewDistance, 6666.f); } mFogColor = color; } @@ -585,8 +585,6 @@ namespace MWRender mCurrentCameraPos = cameraPos; if (mWater->isUnderwater(cameraPos)) { - float viewDistance = mViewDistance; - viewDistance = std::min(viewDistance, 6666.f); setFogColor(mUnderwaterColor * mUnderwaterWeight + mFogColor * (1.f-mUnderwaterWeight)); mStateUpdater->setFogStart(mUnderwaterFogStart); mStateUpdater->setFogEnd(mUnderwaterFogEnd);