mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 09:53:50 +00:00
Merge branch 'fix-5699' into 'master'
Guarantee glow updater regenerates shaders on completion See merge request OpenMW/openmw!435
This commit is contained in:
commit
8fb07b72d5
3 changed files with 23 additions and 0 deletions
|
@ -112,6 +112,8 @@ void GlowUpdater::apply(osg::StateSet *stateset, osg::NodeVisitor *nv)
|
|||
removeTexture(stateset);
|
||||
this->reset();
|
||||
mDone = true;
|
||||
// normally done in StateSetUpdater::operator(), but needs doing here so the shader visitor sees the right StateSet
|
||||
mNode->setStateSet(stateset);
|
||||
mResourceSystem->getSceneManager()->recreateShaders(mNode);
|
||||
}
|
||||
if (mOriginalDuration < 0) // if this glowupdater was originally a permanent glow
|
||||
|
|
|
@ -294,7 +294,10 @@ namespace Shader
|
|||
void ShaderVisitor::createProgram(const ShaderRequirements &reqs)
|
||||
{
|
||||
if (!reqs.mShaderRequired && !mForceShaders)
|
||||
{
|
||||
ensureFFP(*reqs.mNode);
|
||||
return;
|
||||
}
|
||||
|
||||
osg::Node& node = *reqs.mNode;
|
||||
osg::StateSet* writableStateSet = nullptr;
|
||||
|
@ -333,6 +336,19 @@ namespace Shader
|
|||
}
|
||||
}
|
||||
|
||||
void ShaderVisitor::ensureFFP(osg::Node& node)
|
||||
{
|
||||
if (!node.getStateSet() || !node.getStateSet()->getAttribute(osg::StateAttribute::PROGRAM))
|
||||
return;
|
||||
osg::StateSet* writableStateSet = nullptr;
|
||||
if (mAllowedToModifyStateSets)
|
||||
writableStateSet = node.getStateSet();
|
||||
else
|
||||
writableStateSet = getWritableStateSet(node);
|
||||
|
||||
writableStateSet->removeAttribute(osg::StateAttribute::PROGRAM);
|
||||
}
|
||||
|
||||
bool ShaderVisitor::adjustGeometry(osg::Geometry& sourceGeometry, const ShaderRequirements& reqs)
|
||||
{
|
||||
bool useShader = reqs.mShaderRequired || mForceShaders;
|
||||
|
@ -380,6 +396,8 @@ namespace Shader
|
|||
|
||||
createProgram(reqs);
|
||||
}
|
||||
else
|
||||
ensureFFP(geometry);
|
||||
|
||||
if (needPop)
|
||||
popRequirements();
|
||||
|
@ -414,6 +432,8 @@ namespace Shader
|
|||
morph->setSourceGeometry(sourceGeometry);
|
||||
}
|
||||
}
|
||||
else
|
||||
ensureFFP(drawable);
|
||||
|
||||
if (needPop)
|
||||
popRequirements();
|
||||
|
|
|
@ -94,6 +94,7 @@ namespace Shader
|
|||
std::string mDefaultFsTemplate;
|
||||
|
||||
void createProgram(const ShaderRequirements& reqs);
|
||||
void ensureFFP(osg::Node& node);
|
||||
bool adjustGeometry(osg::Geometry& sourceGeometry, const ShaderRequirements& reqs);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue