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:
parent
cbd14833fd
commit
aee1edaf9e
1 changed files with 51 additions and 29 deletions
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue