From 4873d33642ca6973a266244e3b73c40da5f6c6a0 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Sat, 27 Oct 2018 01:25:16 +0300 Subject: [PATCH] Adjust magic light source linear attenuation (bug #3890) --- CHANGELOG.md | 1 + apps/openmw/mwrender/animation.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fa330e778..ed387eaf63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ Bug #3788: GetPCInJail and GetPCTraveling do not work as in vanilla Bug #3836: Script fails to compile when command argument contains "\n" Bug #3876: Landscape texture painting is misaligned + Bug #3890: Magic light source attenuation is inaccurate Bug #3897: Have Goodbye give all choices the effects of Goodbye Bug #3911: [macOS] Typing in the "Content List name" dialog box produces double characters Bug #3920: RemoveSpellEffects doesn't remove constant effects diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index f165b6bd3d..8ae8800a6c 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -1789,9 +1789,12 @@ namespace MWRender } else { - effect += 3; - float radius = effect * 66.f; - float linearAttenuation = 0.5f / effect; + // TODO: use global attenuation settings + + // 1 pt of Light effect magnitude corresponds to 1 foot of light source radius, which is about 21.33 game units, + // but Morrowind uses imprecise value of foot for magic effects. + float radius = effect * 22.f; + float linearAttenuation = 3.f / radius; if (!mGlowLight || linearAttenuation != mGlowLight->getLight(0)->getLinearAttenuation()) { @@ -1813,7 +1816,8 @@ namespace MWRender mGlowLight->setLight(light); } - mGlowLight->setRadius(radius); + // Make the obvious cut-off a bit less obvious + mGlowLight->setRadius(radius * 3); } }