Pass the traversal number instead of the node visitor

pull/1/head
scrawl 9 years ago
parent 08b2d38c54
commit 6fa95e72c5

@ -241,7 +241,7 @@ void RigGeometry::update(osg::NodeVisitor* nv)
return; return;
mLastFrameNumber = nv->getTraversalNumber(); mLastFrameNumber = nv->getTraversalNumber();
mSkeleton->updateBoneMatrices(nv); mSkeleton->updateBoneMatrices(nv->getTraversalNumber());
// skinning // skinning
osg::Vec3Array* positionSrc = static_cast<osg::Vec3Array*>(mSourceGeometry->getVertexArray()); osg::Vec3Array* positionSrc = static_cast<osg::Vec3Array*>(mSourceGeometry->getVertexArray());
@ -301,7 +301,7 @@ void RigGeometry::updateBounds(osg::NodeVisitor *nv)
return; return;
mBoundsFirstFrame = false; mBoundsFirstFrame = false;
mSkeleton->updateBoneMatrices(nv); mSkeleton->updateBoneMatrices(nv->getTraversalNumber());
updateGeomToSkelMatrix(nv); updateGeomToSkelMatrix(nv);

@ -108,12 +108,12 @@ Bone* Skeleton::getBone(const std::string &name)
return bone; return bone;
} }
void Skeleton::updateBoneMatrices(osg::NodeVisitor* nv) void Skeleton::updateBoneMatrices(unsigned int traversalNumber)
{ {
if (nv->getTraversalNumber() != mLastFrameNumber) if (traversalNumber != mLastFrameNumber)
mNeedToUpdateBoneMatrices = true; mNeedToUpdateBoneMatrices = true;
mLastFrameNumber = nv->getTraversalNumber(); mLastFrameNumber = traversalNumber;
if (mLastFrameNumber % 2 == 0) if (mLastFrameNumber % 2 == 0)
mTraversedEvenFrame = true; mTraversedEvenFrame = true;

@ -45,7 +45,7 @@ namespace SceneUtil
Bone* getBone(const std::string& name); Bone* getBone(const std::string& name);
/// Request an update of bone matrices. May be a no-op if already updated in this frame. /// Request an update of bone matrices. May be a no-op if already updated in this frame.
void updateBoneMatrices(osg::NodeVisitor* nv); void updateBoneMatrices(unsigned int traversalNumber);
/// Set the skinning active flag. Inactive skeletons will not have their child rigs updated. /// Set the skinning active flag. Inactive skeletons will not have their child rigs updated.
/// You should set this flag to false if you know that bones are not currently moving. /// You should set this flag to false if you know that bones are not currently moving.

Loading…
Cancel
Save