Hi Max,

 

I don't know if this is related but take a look at the attached email.

There appears to be quite a few issues with the osg::Sequence class and
you are probably encountering one of them.

Please try my suggested fix as it seems to work for me.

 

Regards,

Andy

 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Max
Bandazian
Sent: 07 August 2008 18:26
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] osg sequence timing

 

Hi,
I am experiencing some buggy behavior relating to loaded openflight
files containing sequences, and I would appreciate any suggestions. When
such a file is loaded after the viewer has been running for a bit, the
animation runs at the wrong speed. Here's some sample code that
illustrates the problem:

      osg::ref_ptr<osg::Group> rootNode = new osg::Group;

      osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;
      viewer->setUpViewOnSingleScreen(0);
      viewer->setSceneData(rootNode.get());
      viewer->setCameraManipulator(new osgGA::TrackballManipulator());

      viewer->realize();
      
      while(!viewer->done() && viewer->getFrameStamp()->getFrameNumber()
< 500)
      {
         viewer->frame();
      }

      osg::ref_ptr<osg::Node> modelNode =
osgDB::readNodeFile("some_animation.flt");
      rootNode->addChild(modelNode.get());

      while(!viewer->done())
      {
         viewer->frame();
      }

When the animation gets loaded in the above code, it runs much faster
than it ought to for around 5 seconds, and then runs at the normal rate.
It appears to be "catching up" with the frame time. Sending a visitor
down every loaded flt file and setting sync to true on all sequences
seems to fix the problem, but it seems like this should not be
necessary.

Thanks,
Max Bandazian

--- Begin Message ---
Hi All,

 

I have found a possible bug in osg::Sequence. Can anyone confirm this
and/or let me know if it is fixed in a newer release than 2.4?

 

To reproduce the bug:

1.      Create a template osg::Sequence node (and underlying geometry)
but do not attach the node to the current active scenegraph.
2.      At some point during the rendering loop (perhaps on a keystroke)
clone the sequence node (I use the call:

       dynamic_cast<osg::Node*>(templateNode -> clone( osg::CopyOp(
(osg::CopyOp::CopyFlags)osg::CopyOp::DEEP_COPY_NODES ) ) )

3.      Set the cloned sequence node duration to a value that makes the
animation run slower (i.e. 2.0).
4.      Start the cloned sequence (using setMode()).
5.      Repeat steps 2 - 4 and observe that the cloned sequences do not
run slow but run as fast, appearing to ignore the duration that has been
set on them.

 

Looking at the 'good documentation' (2.4 source code), I see that _start
is being set to _now (osg::Sequence::setMode(), line 192). Should this
not _start not be set to -1.0?

 

PS: It is also interesting to note that when loading OpenFlight file
with the frameTime set to 0.0, setting duration will have no effect.
Perhaps the OpenFlight loader should provide a very small default
frameTime value if the incoming value from the OpenFlight file is 0.0.

 

PS2: It also looks like the _nrepRemain value is not being reset when
setMode( START ) is called. To reset the value you must call setDuration
again.

 

Regards,

Andy

 

Business Development Manager

Embedded Simulation Group

GE Fanuc Intelligent Platforms

Applied Image Processing (formally Octec)

The Western Centre, Western Rd, Bracknell

Berkshire, England, RG12 1RW

Tel:  +44 (0)1344 464908

Fax: +44 (0)1344 465201

Web: http://www.octec.com

GE Fanuc Intelligent Platforms (Bracknell) Ltd, registered in England
and Wales (2393111) at 100 Barbirolli Square, Manchester, M2 3AB, VAT GB
530 094 183

This email is private and confidential and for the addressee only. If
misdirected, please notify us by telephone and confirm that it has been
deleted from your system and any hard copies destroyed. You are strictly
prohibited from using, printing, distributing or disseminating it or any
information contained in it save to the intended recipient.

 

 


--- End Message ---
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to