1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 07:45:39 +00:00

Do not overwrite old removed state with old dummy state

This commit is contained in:
AnyOldName3 2021-06-28 00:11:31 +01:00
parent 0e122b1e3d
commit 2147c18cf5

View file

@ -402,9 +402,12 @@ namespace Shader
{
writableStateSet->addUniform(new osg::Uniform("alphaRef", reqs.mAlphaRef));
const auto* alphaFunc = writableStateSet->getAttributePair(osg::StateAttribute::ALPHAFUNC);
if (alphaFunc)
removedState->setAttribute(alphaFunc->first, alphaFunc->second);
if (!removedState->getAttributePair(osg::StateAttribute::ALPHAFUNC))
{
const auto* alphaFunc = writableStateSet->getAttributePair(osg::StateAttribute::ALPHAFUNC);
if (alphaFunc)
removedState->setAttribute(alphaFunc->first, alphaFunc->second);
}
// This prevents redundant glAlphaFunc calls while letting the shadows bin still see the test
writableStateSet->setAttribute(RemovedAlphaFunc::getInstance(reqs.mAlphaFunc), osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);