Tutorial 101 getting started

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Tutorial 101 getting started

Postby zak » Sun Dec 27, 2009 9:27 am

In tutorial 101 getting started, function AdvanceSimulation in main.cpp, there is:
Code: Select all
int loops = 0;
   physicLoopsTimeAcc = 0;


   while ((loops < MAX_PHYSICS_LOOPS) && (g_timeAccumulator >= DEMO_FPS_IN_MICROSECUNDS))
   {
      loops ++;

      // Process incoming events.
      ProcessEvents (g_world);

      // sample time before the Update
      g_physicTime = GetTimeInMicrosenconds ();

      // run the newton update function
      NewtonUpdate (g_world, (1.0f / DEMO_PHYSICS_FPS));

      // calculate the time spent in the physical Simulation
      g_physicTime = GetTimeInMicrosenconds () - g_physicTime;

      // call the visual debugger to show the physics scene
#ifdef USE_VISUAL_DEBUGGER
      NewtonDebuggerServe (g_newtonDebugger, g_world);
#endif

      // subtract time from time accumulator
      g_timeAccumulator -= DEMO_FPS_IN_MICROSECUNDS;
      physicTime ++;

      physicLoopsTimeAcc += g_physicTime;
   }

   if (loops > MAX_PHYSICS_LOOPS) {
      g_physicTime = physicLoopsTimeAcc;
      g_timeAccumulator = DEMO_FPS_IN_MICROSECUNDS;
   }

i'm wromg or
Code: Select all
if (loops > MAX_PHYSICS_LOOPS) {
      g_physicTime = physicLoopsTimeAcc;
      g_timeAccumulator = DEMO_FPS_IN_MICROSECUNDS;

as is never will be executed?
zak
 
Posts: 87
Joined: Mon Dec 06, 2004 9:30 am

Re: Tutorial 101 getting started

Postby Julio Jerez » Sun Dec 27, 2009 10:25 am

yes it is provably redundance
Julio Jerez
Moderator
Moderator
 
Posts: 12452
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 625 guests