From Pjotr Svetachov, "For a scene with a lot of animated agents I did some small

optimizations to reduce cpu overhead:
1) Avoid a load-hit-store in UpdateBone. b->getMatrixInBoneSpace()
returns the same matrix that was just stored with b->setMatrix()
2) Avoid calling element->isIdentity() for the whole transform stack
(can be expensive is element is a matrix)
3) Make the key frame interpolator use binary search instead of a
linear one. This is very noticeable in scenes where some geometry has
long repeating animations that start at the same time, you will see
the update time grow then reset and grow again."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14294 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2014-06-26 10:45:07 +00:00
parent ed314c6d7d
commit 138ea0e0c7
3 changed files with 18 additions and 22 deletions

View File

@@ -46,9 +46,9 @@ void UpdateBone::operator()(osg::Node* node, osg::NodeVisitor* nv)
Bone* parent = b->getBoneParent();
if (parent)
b->setMatrixInSkeletonSpace(b->getMatrixInBoneSpace() * parent->getMatrixInSkeletonSpace());
b->setMatrixInSkeletonSpace(matrix * parent->getMatrixInSkeletonSpace());
else
b->setMatrixInSkeletonSpace(b->getMatrixInBoneSpace());
b->setMatrixInSkeletonSpace(matrix);
}
traverse(node,nv);
}