Hello Bart,

Is there a way to setup osgOcean such that each time viewer.frame() is called, 
it only progresses a fixed time step?

See here:

http://code.google.com/p/osgocean/source/browse/trunk/include/osgOcean/FFTOceanTechnique#351

By default, osgOcean updates its ocean technique using real elapsed time, but you can use OceanAnimationCallback to give it whatever simulation time you want. You just override the operator() and in it, call update(..., mySimTime), like this:

class MyOceanAnimationCallback : public osgOcean::FFTOceanSurface::OceanAnimationCallback
    {
    public:
        MyOceanAnimationCallback () {}

        virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
        {
            double simulationTime = ...; // get simulation time
            update(node, nv, simulationTime);
        }
    };

And set it on your ocean surface like this:

  oceanSurface->setOceanAnimationCallback(new MyOceanAnimationCallback);

I implemented this feature because we do networked simulations on multiple machines, and this allows us to synchronize the animation of the ocean on all machines given a synched simulation time value that is propagated on the network.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                    http://whitestar02.dyndns-web.com/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to