Hey everyone.
I've come a far way since my last post. Our application is reading sensor data
from the Leap Motion and we are interpreting this data and using OSG to display
the hand models on scene. The issue now is that running on my laptop I get a
tops of 20 fps. On other computers with lower specs the fr is abysmal.
The way its set up right now is that we load the fbx model of a hand and
traverse through its nodes. If it finds a bone and if it is one of the bones
we want to affect we attach an updateCallback. The update callback queries our
data for a new position and the position is updated using a matrix and then the
new position is set:
Code:
osg::ref_ptr<osgAnimation::Bone> bone =
dynamic_cast<osgAnimation::Bone*>(node);
if (bone)
{
ref_ptr<osgAnimation::Bone> parent
= bone->getBoneParent();
const osg::Matrix& matrix
= _transforms.getMatrix();
_transforms.update ();
setBoneOrientations ();
setLocalMatrices
();
setLocalTranslationsAndRotations (parent, &matrix);
if (parent)
bone->setMatrixInSkeletonSpace(fingerSpace *
fingerTranslation * parent->getMatrixInSkeletonSpace());
}
traverse(node, nv);
The setBoneOrientations(), setLocalMatrices() and
setLocalTranslationsAndRotation() are methods used to manipulate the data so
the it fits the position and rototaion on the screen properly. Basically
converting the data to osg coordinate spaces.
The viewer is basically just while(!viewer->done())
I believe in total we end up attaching a callback to about 40 - 50 bones.
20-25 on each hand. This doesn't feel like too much to process but Im no
expert... far from it. Is this the reason causing my low frame rate? If so
what are some steps or things to start looking at to improve performance.
Thanks everyone!
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=61349#61349
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org