Hi Drew,

As Richard suggest what we really need is a FrameStamp with both a
"real time" ReferenceTime and the possibility of SimulationTime.  I
suggested this in another thread during the last couple of weeks.

However, all is not lost...  osgViewer::Viewer and osgProducer::Viewer
both share the same use of osg::FrameStamp that controls the
ReferenceTime.  In the case of osgViewer::Viewer there is a
getFrameStamp() method that you can use to set the time yourself.  The
only cavate is that the Viewer::advance() method called by
Viewer::frame() updates the ReferenceTime.  So what you need to do is
either not call advance() or simply update the FrameStamp after
advance is called.

If you look at Viewer::frame() you'll see its pretty straight forward,
the bits that do the hard word each frame are:

   advance();
   eventTraversal();
   updateTraversal();
   renderingTraversals();

You could easily just calls these in your main loop instead of calling
frame. i.e.

 viewer.realize();

  viewer.init();

  while(!viewer.done())
  {
      viewer.advance();
      viewer.getFrameStamp()->setReferenceTime(myTime);
      viewer.eventTraversal();
      viewer.updateTraversal();
      viewer.renderingTraversals();
  }


Another alternative is to subclass from osgViewer::Viewer and override
the advance() method as it virtual - like the rest of the above Viewer
methods, this is done so you can customize things just the way you
want.  This route would allow you to continue calling frame() and have
your custom advance() done automatically.

The only downside to playing around with FrameStamp's ReferenceTime
would be the syncing of events and stats collection as they be
advancing in real time, not your modified time.  Try it though and see
what happens :-)    FYI, osgProducer::Viewer will had the same
problems w.r.t events and stats.    Its this reason why FrameStamp
SimulationTime would be useful.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to