Revision: 6484
          http://playerstage.svn.sourceforge.net/playerstage/?rev=6484&view=rev
Author:   natepak
Date:     2008-06-06 13:59:07 -0700 (Fri, 06 Jun 2008)

Log Message:
-----------
Cleaned up the mainloop code

Modified Paths:
--------------
    code/gazebo/trunk/server/Simulator.cc

Modified: code/gazebo/trunk/server/Simulator.cc
===================================================================
--- code/gazebo/trunk/server/Simulator.cc       2008-06-06 20:35:03 UTC (rev 
6483)
+++ code/gazebo/trunk/server/Simulator.cc       2008-06-06 20:59:07 UTC (rev 
6484)
@@ -213,6 +213,8 @@
   double step = World::Instance()->GetPhysicsEngine()->GetStepTime();
   double physicsUpdateRate = 
World::Instance()->GetPhysicsEngine()->GetUpdateRate();
   double renderUpdateRate = OgreAdaptor::Instance()->GetUpdateRate();
+  double physicsUpdatePeriod = 1.0 / physicsUpdateRate;
+  double renderUpdatePeriod = 1.0 / renderUpdateRate;
 
   double currTime;
   double elapsedTime;
@@ -225,7 +227,7 @@
     currTime = this->GetRealTime();
 
     if (physicsUpdateRate == 0 || 
-        currTime - this->prevPhysicsTime >= 1.0/physicsUpdateRate) 
+        currTime - this->prevPhysicsTime >= physicsUpdatePeriod) 
     {
       this->simTime += step;
 
@@ -250,7 +252,7 @@
 
     // Update the rendering
     if (renderUpdateRate == 0 || 
-        currTime - this->prevRenderTime >= 1.0/renderUpdateRate)
+        currTime - this->prevRenderTime >= renderUpdatePeriod)
     {
       this->GetRenderEngine()->Render(); 
       this->prevRenderTime = this->GetRealTime();


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to