|
|
@ -38,6 +38,8 @@ Skeleton::Skeleton()
|
|
|
|
, mNeedToUpdateBoneMatrices(true)
|
|
|
|
, mNeedToUpdateBoneMatrices(true)
|
|
|
|
, mActive(true)
|
|
|
|
, mActive(true)
|
|
|
|
, mLastFrameNumber(0)
|
|
|
|
, mLastFrameNumber(0)
|
|
|
|
|
|
|
|
, mTraversedEvenFrame(false)
|
|
|
|
|
|
|
|
, mTraversedOddFrame(false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -48,6 +50,8 @@ Skeleton::Skeleton(const Skeleton ©, const osg::CopyOp ©op)
|
|
|
|
, mNeedToUpdateBoneMatrices(true)
|
|
|
|
, mNeedToUpdateBoneMatrices(true)
|
|
|
|
, mActive(copy.mActive)
|
|
|
|
, mActive(copy.mActive)
|
|
|
|
, mLastFrameNumber(0)
|
|
|
|
, mLastFrameNumber(0)
|
|
|
|
|
|
|
|
, mTraversedEvenFrame(false)
|
|
|
|
|
|
|
|
, mTraversedOddFrame(false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -111,6 +115,11 @@ void Skeleton::updateBoneMatrices(osg::NodeVisitor* nv)
|
|
|
|
|
|
|
|
|
|
|
|
mLastFrameNumber = nv->getTraversalNumber();
|
|
|
|
mLastFrameNumber = nv->getTraversalNumber();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mLastFrameNumber % 2 == 0)
|
|
|
|
|
|
|
|
mTraversedEvenFrame = true;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
mTraversedOddFrame = true;
|
|
|
|
|
|
|
|
|
|
|
|
if (mNeedToUpdateBoneMatrices)
|
|
|
|
if (mNeedToUpdateBoneMatrices)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (mRootBone.get())
|
|
|
|
if (mRootBone.get())
|
|
|
@ -140,7 +149,7 @@ void Skeleton::traverse(osg::NodeVisitor& nv)
|
|
|
|
if (!getActive() && nv.getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR
|
|
|
|
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
|
|
|
|
// 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
|
|
|
|
// 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())
|
|
|
|
&& mLastFrameNumber != 0 && mTraversedEvenFrame && mTraversedOddFrame)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
osg::Group::traverse(nv);
|
|
|
|
osg::Group::traverse(nv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|