1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-21 06:09:42 +00:00

Merge pull request #3106 from bosvensson1/bosvensson1-patch-2

consolidate a uniform related to shadows
This commit is contained in:
Chris Djali 2021-09-15 00:48:03 +01:00 committed by GitHub
commit 633b4852d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 9 deletions

View file

@ -54,6 +54,7 @@ ShadowsBin::ShadowsBin()
mShaderAlphaTestStateSet = new osg::StateSet;
mShaderAlphaTestStateSet->addUniform(new osg::Uniform("alphaTestShadows", true));
mShaderAlphaTestStateSet->addUniform(new osg::Uniform("useDiffuseMapForShadowAlpha", true));
mShaderAlphaTestStateSet->setMode(GL_BLEND, osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED | osg::StateAttribute::OVERRIDE);
for (size_t i = 0; i < sCastingPrograms.size(); ++i)

View file

@ -340,15 +340,6 @@ namespace Shader
mRequirements.back().mShaderRequired = true;
}
}
if (diffuseMap)
{
if (!writableStateSet)
writableStateSet = getWritableStateSet(node);
// We probably shouldn't construct a new version of this each time as Uniforms use pointer comparison for early-out.
// Also it should probably belong to the shader manager or be applied by the shadows bin
writableStateSet->addUniform(new osg::Uniform("useDiffuseMapForShadowAlpha", true));
}
}
const osg::StateSet::AttributeList& attributes = stateset->getAttributeList();
@ -467,6 +458,9 @@ namespace Shader
defineMap[texIt->second + std::string("UV")] = std::to_string(texIt->first);
}
if (defineMap["diffuseMap"] == "0")
writableStateSet->addUniform(new osg::Uniform("useDiffuseMapForShadowAlpha", false));
defineMap["parallax"] = reqs.mNormalHeight ? "1" : "0";
writableStateSet->addUniform(new osg::Uniform("colorMode", reqs.mColorMode));