|
|
|
@ -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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|