Added AnimationPathCallback::getAnimationTime() method

This commit is contained in:
Robert Osfield 2004-01-31 11:34:28 +00:00
parent 434e16598e
commit d83fa3fca5
2 changed files with 10 additions and 3 deletions

View File

@ -232,6 +232,10 @@ class SG_EXPORT AnimationPathCallback : public NodeCallback
void setPause(bool pause);
/** get the animation time that is used to specify the position along the AnimationPath.
* Animation time is computed from the formula ((_latestTime-_firstTime)-_timeOffset)*_timeMultiplier.*/
double getAnimationTime() const;
/** implements the callback*/
virtual void operator()(Node* node, NodeVisitor* nv);

View File

@ -168,12 +168,15 @@ void AnimationPathCallback::operator()(Node* node, NodeVisitor* nv)
NodeCallback::traverse(node,nv);
}
double AnimationPathCallback::getAnimationTime() const
{
return ((_latestTime-_firstTime)-_timeOffset)*_timeMultiplier;
}
void AnimationPathCallback::update(osg::Node& node)
{
double animationTime = ((_latestTime-_firstTime)-_timeOffset)*_timeMultiplier;
AnimationPath::ControlPoint cp;
if (_animationPath->getInterpolatedControlPoint(animationTime,cp))
if (_animationPath->getInterpolatedControlPoint(getAnimationTime(),cp))
{
AnimationPathCallbackVisitor apcv(cp,_useInverseMatrix);
node.accept(apcv);