Esempio n. 1
0
void Px3World::destroyWorld()
{
   getPhysicsResults();

   mRenderBuffer = NULL;

   // Release the tick processing signals.
   if ( mProcessList )
   {
      mProcessList->preTickSignal().remove( this, &Px3World::getPhysicsResults );
      mProcessList->postTickSignal().remove( this, &Px3World::tickPhysics );
      mProcessList = NULL;
   }

   if(mControllerManager)
   {
      mControllerManager->release();
      mControllerManager = NULL;
   }
   
   // Destroy the scene.
   if ( mScene )
   {
      // Release the scene.
      mScene->release();
      mScene = NULL;
   }
}
Esempio n. 2
0
void Px3World::setEnabled( bool enabled )
{
   mIsEnabled = enabled;

   if ( !mIsEnabled )
      getPhysicsResults();
}
Esempio n. 3
0
void PxWorld::_destroy()
{
   // Make sure the simulation is stopped!
   getPhysicsResults();
   _releaseQueues();

   #ifdef TORQUE_DEBUG

      U32 actorCount = mScene->getNbActors();
      U32 jointCount = mScene->getNbJoints();
      
      if ( actorCount != 0 || jointCount != 0 )
      {
         // Dump the names of any actors or joints that
         // were not released before the destruction of
         // this scene.

         for ( U32 i=0; i < actorCount; i++ )
         {
            const NxActor *actor = mScene->getActors()[i];
            Con::errorf( "Orphan NxActor - '%s'!", actor->getName() );
         }

         mScene->resetJointIterator();
         for ( ;; )
         {
            const NxJoint *joint = mScene->getNextJoint();
            if ( !joint )
               break;

            Con::errorf( "Orphan NxJoint - '%s'!", joint->getName() );
         }

         AssertFatal( false, "PhysXWorld::_destroy() - Some actors and/or joints were not released!" );
      }

   #endif // TORQUE_DEBUG

   //NxCloseCooking();

   // Release the tick processing signals.
   if ( mProcessList )
   {
      mProcessList->preTickSignal().remove( this, &PxWorld::getPhysicsResults );
      mProcessList->postTickSignal().remove( this, &PxWorld::tickPhysics );
      //mProcessList->catchupModeSignal().remove( this, &PxWorld::enableCatchupMode );
      mProcessList = NULL;
   }

   // Destroy the scene.
   if ( mScene )
   {
      // You never destroy compartments... they are
      // released along with the scene.
      mRigidCompartment = NULL;

      // Delete the contact reporter.
      mScene->setUserContactReport( NULL );
      SAFE_DELETE( mConactReporter );

      // First shut down threads... this makes it 
      // safe to release the scene.
      mScene->shutdownWorkerThreads();

      // Release the scene.
      gPhysicsSDK->releaseScene( *mScene );
      mScene = NULL;
   }

   // Try to restart the sdk if we can.
   //restartSDK();
}