1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 17:29:55 +00:00

Partially revert "Attach shaders to geometry that lacks a stateset if necessary"

This reverts commit 6aef366fd3.
This commit is contained in:
AnyOldName3 2023-03-08 00:15:49 +00:00
parent cbd14833fd
commit aee1edaf9e

View file

@ -865,24 +865,42 @@ namespace Shader
void ShaderVisitor::apply(osg::Geometry& geometry) void ShaderVisitor::apply(osg::Geometry& geometry)
{ {
pushRequirements(geometry); bool needPop = (geometry.getStateSet() != nullptr);
if (geometry.getStateSet()) // TODO: check if stateset affects shader permutation before pushing it if (geometry.getStateSet()) // TODO: check if stateset affects shader permutation before pushing it
{
pushRequirements(geometry);
applyStateSet(geometry.getStateSet(), geometry); applyStateSet(geometry.getStateSet(), geometry);
}
if (!mRequirements.empty())
{
const ShaderRequirements& reqs = mRequirements.back(); const ShaderRequirements& reqs = mRequirements.back();
adjustGeometry(geometry, reqs);
createProgram(reqs);
adjustGeometry(geometry, reqs);
createProgram(reqs);
}
else
ensureFFP(geometry);
if (needPop)
popRequirements(); popRequirements();
} }
void ShaderVisitor::apply(osg::Drawable& drawable) void ShaderVisitor::apply(osg::Drawable& drawable)
{
bool needPop = drawable.getStateSet();
if (needPop)
{ {
pushRequirements(drawable); pushRequirements(drawable);
if (drawable.getStateSet()) if (drawable.getStateSet())
applyStateSet(drawable.getStateSet(), drawable); applyStateSet(drawable.getStateSet(), drawable);
}
if (!mRequirements.empty())
{
const ShaderRequirements& reqs = mRequirements.back(); const ShaderRequirements& reqs = mRequirements.back();
createProgram(reqs); createProgram(reqs);
@ -908,7 +926,11 @@ namespace Shader
osgaRig->setSourceRigGeometry(sourceOsgaRigGeometry); osgaRig->setSourceRigGeometry(sourceOsgaRigGeometry);
} }
} }
}
else
ensureFFP(drawable);
if (needPop)
popRequirements(); popRequirements();
} }