[osg-users] Updating multiple times references to AnimatioPaths

Robert Osfield robert.osfield at gmail.com
Fri Jul 11 08:25:09 PDT 2008


Hi Alberto,

There isn't lazy updating of the control point in
AnimationPathCallback, as you've found it'll compute the control point
on demand.  Attach a single callback to many nodes is not typical
practice so such a lazy updating technique wouldn't be critical to
most.  It'd be easy to add though by just modifying the
AnimationPathCallback::update(Node& node) method to something like:

void AnimationPathCallback::update(osg::Node& node)
{
    if (_cpCacheTime!=getAnimationTime())
    {
          _animationPath->getInterpolatedControlPoint(getAnimationTime(),_cpCached);
         _cpCacheTime =getAnimationTime();
    }

    AnimationPathCallbackVisitor apcv(_cpCached,_pivotPoint,_useInverseMatrix);
    node.accept(apcv);
}


Feel free to code such a change, and if it works out fine for you to
submit it to osg-submissions.

Robert.



More information about the osg-users mailing list