OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

osgOcean time control


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgOcean [osgOcean]
View previous topic :: View next topic  
Author Message
Galto2000
Newbie


Joined: 14 Apr 2010
Posts: 19

PostPosted: Mon Nov 07, 2011 9:18 pm    Post subject:
osgOcean time control
Reply with quote

Howdy all,

The way I am using OSG is probably atypical: I am not using it for visualization perse, but mainly to simulate (stereo) vision sensors for AI agents.

As a result, my runtime is "simulated time" (and not real-time or system time). Hence, when I run my viewer-loop, each iteration is a fixed time step (1/30th of a second).

I believe that osgOcean however is running in its own thread using system time, so as a result my AI agent perceives an ocean that moves 30 times too fast.

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


Cheers,
bart
Back to top
View user's profile Send private message
Skylark (Jean-S├ębastien Guay)
Professional


Joined: 05 Jan 2009
Posts: 2249

PostPosted: Mon Nov 07, 2011 9:58 pm    Post subject:
osgOcean time control
Reply with quote

Hello Bart,

Quote:
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
http://www.cm-labs.com/
http://whitestar02.dyndns-web.com/


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Galto2000
Newbie


Joined: 14 Apr 2010
Posts: 19

PostPosted: Tue Nov 08, 2011 4:06 pm    Post subject:
Re: osgOcean time control
Reply with quote

Hi J-S

thanks for the information.

Looking at the link you provided me, the code I have downloaded from http://code.google.com/p/osgocean/downloads/list is different (and has issues like nested protected classes which MSVC is complaining about).

I have osgOcean 1.0.1, released on 03/11/09 - is there a later version available somewhere else?

Cheers

Bart
Back to top
View user's profile Send private message
kcbale
User


Joined: 04 Mar 2011
Posts: 68

PostPosted: Tue Nov 08, 2011 4:13 pm    Post subject:
osgOcean time control
Reply with quote

I would work with the version in the trunk.. 1.0.1 is rather dated. I really do need to do a review and do a new release..

K.

On 8 November 2011 16:06, bart gallet < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi J-S

thanks for the information.

Looking at the link you provided me, the code I have downloaded from http://code.google.com/p/osgocean/downloads/list is different (and has issues like nested protected classes which MSVC is complaining about).

I have osgOcean 1.0.1, released on 03/11/09 - is there a later version available somewhere else?

Cheers

Bart

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=43771#43771





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Galto2000
Newbie


Joined: 14 Apr 2010
Posts: 19

PostPosted: Tue Nov 08, 2011 6:31 pm    Post subject:
Reply with quote

Hi Kim,

thanks for the advice

Cheers,
bart
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgOcean [osgOcean] All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts osgParticle behavior with discontinuo... robs General 1 Sun Jan 15, 2017 2:40 am View latest post
No new posts How to merge osgocean and osgearth Rambabu General 2 Wed Dec 07, 2016 12:43 pm View latest post
No new posts OsgOcean Rambabu General 1 Mon Nov 28, 2016 11:00 am View latest post
No new posts osgOcean and osgSim::LOS segmentation... Paradox osgOcean [osgOcean] 0 Fri Oct 28, 2016 4:20 pm View latest post
No new posts Measure Render-Time prior to SwapBuff... mille25 General 0 Tue Oct 25, 2016 8:57 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP