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

This reverts commit 6aef366fd3.
depth-refraction
AnyOldName3 2 years ago
parent cbd14833fd
commit aee1edaf9e

@ -865,24 +865,42 @@ namespace Shader
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
{
pushRequirements(geometry);
applyStateSet(geometry.getStateSet(), geometry);
}
if (!mRequirements.empty())
{
const ShaderRequirements& reqs = mRequirements.back();
adjustGeometry(geometry, reqs);
createProgram(reqs);
}
else
ensureFFP(geometry);
if (needPop)
popRequirements();
}
void ShaderVisitor::apply(osg::Drawable& drawable)
{
bool needPop = drawable.getStateSet();
if (needPop)
{
pushRequirements(drawable);
if (drawable.getStateSet())
applyStateSet(drawable.getStateSet(), drawable);
}
if (!mRequirements.empty())
{
const ShaderRequirements& reqs = mRequirements.back();
createProgram(reqs);
@ -908,7 +926,11 @@ namespace Shader
osgaRig->setSourceRigGeometry(sourceOsgaRigGeometry);
}
}
}
else
ensureFFP(drawable);
if (needPop)
popRequirements();
}

Loading…
Cancel
Save