1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-15 18:39:51 +00:00

don't pingpong depth function on character preview update

This commit is contained in:
glassmancody.info 2021-08-18 15:46:25 -07:00
parent 6360bdc859
commit a6c7fcd436

View File

@ -132,6 +132,12 @@ namespace MWRender
newStateSet->addUniform(mNoAlphaUniform);
}
if (SceneUtil::getReverseZ() && stateset->getAttribute(osg::StateAttribute::DEPTH))
{
bool depthModified = false;
osg::Depth* depth = static_cast<osg::Depth*>(stateset->getAttribute(osg::StateAttribute::DEPTH));
depth->getUserValue("depthModified", depthModified);
if (!depthModified)
{
if (!newStateSet)
{
@ -139,8 +145,8 @@ namespace MWRender
node.setStateSet(newStateSet);
}
// Setup standard depth ranges
osg::Depth* depth = static_cast<osg::Depth*>(stateset->getAttribute(osg::StateAttribute::DEPTH));
osg::ref_ptr<osg::Depth> newDepth = new osg::Depth(*depth);
switch (newDepth->getFunction())
{
case osg::Depth::LESS:
@ -159,6 +165,8 @@ namespace MWRender
break;
}
newStateSet->setAttribute(newDepth, osg::StateAttribute::ON);
newDepth->setUserValue("depthModified", true);
}
}
}
traverse(node);