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:
commit
633b4852d5
2 changed files with 4 additions and 9 deletions
|
@ -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)
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue