mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-19 19:39:41 +00:00
Fix inactive RigGeometry not rendering correctly
This commit is contained in:
parent
e0c9265148
commit
eb458bf9c8
2 changed files with 7 additions and 2 deletions
|
@ -82,7 +82,7 @@ RigGeometry::RigGeometry(const RigGeometry ©, const osg::CopyOp ©op)
|
||||||
, mSkeleton(NULL)
|
, mSkeleton(NULL)
|
||||||
, mInfluenceMap(copy.mInfluenceMap)
|
, mInfluenceMap(copy.mInfluenceMap)
|
||||||
, mLastFrameNumber(0)
|
, mLastFrameNumber(0)
|
||||||
, mBoundsFirstFrame(copy.mBoundsFirstFrame)
|
, mBoundsFirstFrame(true)
|
||||||
{
|
{
|
||||||
setSourceGeometry(copy.mSourceGeometry);
|
setSourceGeometry(copy.mSourceGeometry);
|
||||||
}
|
}
|
||||||
|
@ -211,6 +211,8 @@ void RigGeometry::update(osg::NodeVisitor* nv)
|
||||||
{
|
{
|
||||||
if (!mSkeleton)
|
if (!mSkeleton)
|
||||||
{
|
{
|
||||||
|
std::cerr << "RigGeometry rendering with no skeleton, should have been initialized by UpdateVisitor" << std::endl;
|
||||||
|
// try to recover anyway, though rendering is likely to be incorrect.
|
||||||
if (!initFromParentSkeleton(nv))
|
if (!initFromParentSkeleton(nv))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,10 @@ bool Skeleton::getActive() const
|
||||||
|
|
||||||
void Skeleton::traverse(osg::NodeVisitor& nv)
|
void Skeleton::traverse(osg::NodeVisitor& nv)
|
||||||
{
|
{
|
||||||
if (!mActive && nv.getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR && mLastFrameNumber != 0)
|
if (!getActive() && nv.getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR
|
||||||
|
// need to process at least 2 frames before shutting off update, since we need to have both frame-alternating RigGeometries initialized
|
||||||
|
// this would be more naturally handled if the double-buffering was implemented in RigGeometry itself rather than in a FrameSwitch decorator node
|
||||||
|
&& mLastFrameNumber != 0 && mLastFrameNumber+2 <= nv.getTraversalNumber())
|
||||||
return;
|
return;
|
||||||
osg::Group::traverse(nv);
|
osg::Group::traverse(nv);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue