1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-22 23:09:43 +00:00

Merge pull request #1988 from Capostrophic/light

Adjust magic light source linear attenuation (bug #3890)
This commit is contained in:
Bret Curtis 2018-10-27 17:43:48 +02:00 committed by GitHub
commit 5b26c231b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View file

@ -33,6 +33,7 @@
Bug #3788: GetPCInJail and GetPCTraveling do not work as in vanilla Bug #3788: GetPCInJail and GetPCTraveling do not work as in vanilla
Bug #3836: Script fails to compile when command argument contains "\n" Bug #3836: Script fails to compile when command argument contains "\n"
Bug #3876: Landscape texture painting is misaligned 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 #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 #3911: [macOS] Typing in the "Content List name" dialog box produces double characters
Bug #3920: RemoveSpellEffects doesn't remove constant effects Bug #3920: RemoveSpellEffects doesn't remove constant effects

View file

@ -15,13 +15,13 @@
#include <components/debug/debuglog.hpp> #include <components/debug/debuglog.hpp>
#include <components/nifosg/nifloader.hpp>
#include <components/resource/resourcesystem.hpp> #include <components/resource/resourcesystem.hpp>
#include <components/resource/scenemanager.hpp> #include <components/resource/scenemanager.hpp>
#include <components/resource/keyframemanager.hpp> #include <components/resource/keyframemanager.hpp>
#include <components/resource/imagemanager.hpp> #include <components/resource/imagemanager.hpp>
#include <components/misc/constants.hpp>
#include <components/nifosg/nifloader.hpp> // KeyframeHolder #include <components/nifosg/nifloader.hpp> // KeyframeHolder
#include <components/nifosg/controller.hpp> #include <components/nifosg/controller.hpp>
@ -1789,9 +1789,12 @@ namespace MWRender
} }
else else
{ {
effect += 3; // TODO: use global attenuation settings
float radius = effect * 66.f;
float linearAttenuation = 0.5f / effect; // 1 pt of Light magnitude corresponds to 1 foot of radius
float radius = effect * std::ceil(Constants::UnitsPerFoot);
const float linearValue = 3.f; // Currently hardcoded: unmodified Morrowind attenuation settings
float linearAttenuation = linearValue / radius;
if (!mGlowLight || linearAttenuation != mGlowLight->getLight(0)->getLinearAttenuation()) if (!mGlowLight || linearAttenuation != mGlowLight->getLight(0)->getLinearAttenuation())
{ {
@ -1813,7 +1816,8 @@ namespace MWRender
mGlowLight->setLight(light); mGlowLight->setLight(light);
} }
mGlowLight->setRadius(radius); // Make the obvious cut-off a bit less obvious
mGlowLight->setRadius(radius * 3);
} }
} }