Well I found a fix that works around my problem, it doesn't really clean
up the behaviour that I noted in the posts above but does do what I
want. The problem was to do with osg::AnimationPathCallback which
calculates it values relative to the first time it's evaluated. So when
the window was first realized the time was already > 0.0. Hence the
_firstTime member variable was set to a number > 0.0 meaning it isn't
evaluated at the framestamp's time for that particular frame. I get
around it by overriding the operator() and zeroing out _firstTime;
Possibly a bug ?
-Drew
class MyAnimationPathCallback : public osg::AnimationPathCallback
{
public:
MyAnimationPathCallback(osg::AnimationPath* ap,double
timeOffset=0.0,double timeMultiplier=1.0) :
osg::AnimationPathCallback(ap,timeOffset,timeMultiplier) {}
void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
if (_animationPath.valid() &&
nv->getVisitorType()==osg::NodeVisitor::UPDATE_VISITOR &&
nv->getFrameStamp())
{
double time = nv->getFrameStamp()->getReferenceTime();
_latestTime = time;
if (!_pause)
{
// Only update _firstTime the first time, when its value
is still DBL_MAX
if (_firstTime==DBL_MAX) _firstTime = 0.0; //
<<<<<<----------------------- force it to be 0.0 instead of time
update(*node);
}
}
// must call any nested node callbacks and continue subgraph
traversal.
NodeCallback::traverse(node,nv);
}
};
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/