diff options
author | psi29a <psi29a@gmail.com> | 2022-01-09 11:07:14 +0000 |
---|---|---|
committer | psi29a <psi29a@gmail.com> | 2022-01-09 11:07:14 +0000 |
commit | a1f8db760070b3b4b3b36f7765c8069c946f3413 (patch) | |
tree | a02b110414c851804553a438edbfc4a03f7f0dcc | |
parent | d48f072b971cb517528fcb2a84ca5595274586d4 (diff) | |
parent | 8216410e7d50ffd2bf6d0a62810880eb9da83c3b (diff) |
Merge branch 'bright_spells' into 'master'
Replicate Morrowind spell lighting (#4949)
Closes #4949
See merge request OpenMW/openmw!1544
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | apps/openmw/mwrender/animation.cpp | 18 |
2 files changed, 18 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 63fcb91cef..3be525b001 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Bug #4602: Robert's Bodies: crash inside createInstance() Bug #4700: Editor: Incorrect command implementation Bug #4744: Invisible particles must still be processed + Bug #4949: Incorrect particle lighting Bug #5088: Sky abruptly changes direction during certain weather transitions Bug #5100: Persuasion doesn't always clamp the resulting disposition Bug #5120: Scripted object spawning updates physics system diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index bf0ed04055..732ffd33aa 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -7,6 +7,7 @@ #include <osg/BlendFunc> #include <osg/Material> #include <osg/Switch> +#include <osg/LightModel> #include <osgParticle/ParticleSystem> #include <osgParticle/ParticleProcessor> @@ -372,6 +373,19 @@ namespace private: int mEffectId; }; + + osg::ref_ptr<osg::LightModel> getVFXLightModelInstance() + { + static osg::ref_ptr<osg::LightModel> lightModel = nullptr; + + if (!lightModel) + { + lightModel = new osg::LightModel; + lightModel->setAmbientIntensity({1,1,1,1}); + } + + return lightModel; + } } namespace MWRender @@ -1547,7 +1561,9 @@ namespace MWRender parentNode->addChild(trans); osg::ref_ptr<osg::Node> node = mResourceSystem->getSceneManager()->getInstance(model, trans); - node->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF); + + // Morrowind has a white ambient light attached to the root VFX node of the scenegraph + node->getOrCreateStateSet()->setAttributeAndModes(getVFXLightModelInstance(), osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); SceneUtil::FindMaxControllerLengthVisitor findMaxLengthVisitor; node->accept(findMaxLengthVisitor); |