mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-13 12:40:04 +00:00
don't pingpong depth function on character preview update
This commit is contained in:
parent
6360bdc859
commit
a6c7fcd436
@ -133,32 +133,40 @@ namespace MWRender
|
|||||||
}
|
}
|
||||||
if (SceneUtil::getReverseZ() && stateset->getAttribute(osg::StateAttribute::DEPTH))
|
if (SceneUtil::getReverseZ() && stateset->getAttribute(osg::StateAttribute::DEPTH))
|
||||||
{
|
{
|
||||||
if (!newStateSet)
|
bool depthModified = false;
|
||||||
{
|
|
||||||
newStateSet = new osg::StateSet(*stateset, osg::CopyOp::SHALLOW_COPY);
|
|
||||||
node.setStateSet(newStateSet);
|
|
||||||
}
|
|
||||||
// Setup standard depth ranges
|
|
||||||
osg::Depth* depth = static_cast<osg::Depth*>(stateset->getAttribute(osg::StateAttribute::DEPTH));
|
osg::Depth* depth = static_cast<osg::Depth*>(stateset->getAttribute(osg::StateAttribute::DEPTH));
|
||||||
osg::ref_ptr<osg::Depth> newDepth = new osg::Depth(*depth);
|
depth->getUserValue("depthModified", depthModified);
|
||||||
switch (newDepth->getFunction())
|
|
||||||
|
if (!depthModified)
|
||||||
{
|
{
|
||||||
case osg::Depth::LESS:
|
if (!newStateSet)
|
||||||
newDepth->setFunction(osg::Depth::GREATER);
|
{
|
||||||
break;
|
newStateSet = new osg::StateSet(*stateset, osg::CopyOp::SHALLOW_COPY);
|
||||||
case osg::Depth::LEQUAL:
|
node.setStateSet(newStateSet);
|
||||||
newDepth->setFunction(osg::Depth::GEQUAL);
|
}
|
||||||
break;
|
// Setup standard depth ranges
|
||||||
case osg::Depth::GREATER:
|
osg::ref_ptr<osg::Depth> newDepth = new osg::Depth(*depth);
|
||||||
newDepth->setFunction(osg::Depth::LESS);
|
|
||||||
break;
|
switch (newDepth->getFunction())
|
||||||
case osg::Depth::GEQUAL:
|
{
|
||||||
newDepth->setFunction(osg::Depth::LEQUAL);
|
case osg::Depth::LESS:
|
||||||
break;
|
newDepth->setFunction(osg::Depth::GREATER);
|
||||||
default:
|
break;
|
||||||
break;
|
case osg::Depth::LEQUAL:
|
||||||
|
newDepth->setFunction(osg::Depth::GEQUAL);
|
||||||
|
break;
|
||||||
|
case osg::Depth::GREATER:
|
||||||
|
newDepth->setFunction(osg::Depth::LESS);
|
||||||
|
break;
|
||||||
|
case osg::Depth::GEQUAL:
|
||||||
|
newDepth->setFunction(osg::Depth::LEQUAL);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
newStateSet->setAttribute(newDepth, osg::StateAttribute::ON);
|
||||||
|
newDepth->setUserValue("depthModified", true);
|
||||||
}
|
}
|
||||||
newStateSet->setAttribute(newDepth, osg::StateAttribute::ON);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
traverse(node);
|
traverse(node);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user