[osg-users] Get Animation current time

Diego Mancilla dmancillac at gmail.com
Fri Jan 4 07:00:49 PST 2019


Hello Robert,

Thank you again for your answer.

Regarding your question "the AnimationPathCallback::update method)?": yes, from the source:


Code:
void AnimationPathCallback::update(osg::Node& node)
{
    AnimationPath::ControlPoint cp;
    if (_animationPath->getInterpolatedControlPoint(getAnimationTime(),cp))
    {
        AnimationPathCallbackVisitor apcv(cp,_pivotPoint,_useInverseMatrix);
        node.accept(apcv);
    }
}




 I ended up writing my own AnimationPathCallback for manipulating the animation time though the variables _firstTime, _latestTime and _timeOffset; and exposing  AnimationPathCallbackVisitor class to my code in order to force position changes. Maybe my solution is rather far-fetched, but for now it works. Also, I'm using a dummy AnimationPathCallback in order to expose current animation time to Qt.

I have another question rather technical. As per now a have a lot of moving objects. I'm using standard AnimationPath instances for each one of them. Also y have a lot a control points for each one (20k+). So filling the AnimationPaths instances is very slow. Then:

1- Can I using OpenMP or standard Qt threading parallelize the insertion of control points?
2- Are osg classes threadsafe? I mean, can I send the generation (filling) of each AnimationPath on a different thread (and then use the addChild method)?
3- Is there another alternative to improve performance on this matter? 


Cheers,

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=75380#75380







More information about the osg-users mailing list