Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

void Impala::Application::Videolympics::PhysicsEngine::DoPhysics (  )  [inline]

Definition at line 300 of file PhysicsEngine.h.

References ILOG_DEBUG, ILOG_ERROR, mFlushCounter, mIsFlushing, and mParts.

Referenced by Impala::Application::Videolympics::VidolviWindow::DisplayFunc().

00301     {
00302         int before = mParts.size();
00303         for (int i = 0; i < mParts.size(); i++) {
00304             PhysicsPart *p = mParts[i];
00305             if (p == NULL) {
00306                 ILOG_ERROR("DoPhysics - PhysicsPart " << i << " = NULL.");
00307                 continue;
00308             }
00309 
00310             if (p->IsDestroying())
00311             {
00312                 mParts.erase(mParts.begin() + i, mParts.begin() + i + 1);
00313                 i--;
00314                 continue;
00315             }
00316             p->DoPhysics();
00317         }
00318 //         if (mParts.size() != before)
00319 //         {
00320 //             ILOG_DEBUG("NR OF PARTS BEFORE: " << before);
00321 //             ILOG_DEBUG("NR OF PARTS AFTER:  " << mParts.size());
00322 //         }
00323 
00324         if (mIsFlushing)
00325         {
00326             if (mFlushCounter <= 0)
00327             {
00328                 ILOG_DEBUG("Flush counter reached zero. Destroying everything in sight.");
00329 
00330                 // Everything flushed, destroy all.
00331                 for (int i = 0; i < mParts.size(); i++) {
00332                     PhysicsPart *p = mParts[i];
00333                     if (p == NULL) {
00334                         ILOG_ERROR("DoPhysics - PhysicsPart " << i << " = NULL.");
00335                         continue;
00336                     }
00337         
00338                     p->DoDestroyPart();
00339                 }
00340 
00341                 mParts.clear();
00342 
00343                 mIsFlushing = false;
00344                 mFlushCounter = 0;
00345             }
00346             mFlushCounter--;
00347         }
00348     }


Generated on Fri Mar 19 10:55:07 2010 for ImpalaSrc by  doxygen 1.5.1