浏览代码

Bullet plugin update for bullet 2.85.

Fix potential crash with BtPlayer::_stepForward
rextimmy 8 年之前
父节点
当前提交
c08f75f52a

+ 1 - 7
Engine/source/T3D/physics/bullet/bt.h

@@ -39,10 +39,4 @@
 #include <BulletCollision/CollisionDispatch/btGhostObject.h>
 #include <BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h>
 
-#include <BulletMultiThreaded/PlatformDefinitions.h>
-#include <BulletMultiThreaded/SpuGatheringCollisionDispatcher.h>
-#include <BulletMultiThreaded/Win32ThreadSupport.h>
-#include <BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.h>
-
-
-#endif // _BULLET_H_
+#endif // _BULLET_H_

+ 1 - 1
Engine/source/T3D/physics/bullet/btPlayer.cpp

@@ -342,7 +342,7 @@ void BtPlayer::_stepForward( btVector3 *inOutCurrPos, const btVector3 &displacem
 		start.setOrigin( *inOutCurrPos );
 		end.setOrigin( *inOutCurrPos + disp );
 
-      BtPlayerSweepCallback callback( mGhostObject, disp.length2() > 0.0f ? disp.normalized() : disp );
+      BtPlayerSweepCallback callback( mGhostObject, disp.length2() > SIMD_EPSILON ? disp.normalized() : disp );
 		callback.m_collisionFilterGroup = mGhostObject->getBroadphaseHandle()->m_collisionFilterGroup;
 		callback.m_collisionFilterMask = mGhostObject->getBroadphaseHandle()->m_collisionFilterMask;
 

+ 4 - 37
Engine/source/T3D/physics/bullet/btWorld.cpp

@@ -33,11 +33,6 @@
 #include "console/consoleTypes.h"
 #include "scene/sceneRenderState.h"
 #include "T3D/gameBase/gameProcess.h"
-#ifdef _WIN32
-#include "BulletMultiThreaded/Win32ThreadSupport.h"
-#elif defined (USE_PTHREADS)
-#include "BulletMultiThreaded/PosixThreadSupport.h"
-#endif
 
 BtWorld::BtWorld() :
    mProcessList( NULL ),
@@ -46,8 +41,7 @@ BtWorld::BtWorld() :
    mTickCount( 0 ),
    mIsEnabled( false ),
    mEditorTimeScale( 1.0f ),
-   mDynamicsWorld( NULL ),
-   mThreadSupportCollision( NULL )
+   mDynamicsWorld( NULL )
 {
 } 
 
@@ -59,33 +53,7 @@ bool BtWorld::initWorld( bool isServer, ProcessList *processList )
 {
    // Collision configuration contains default setup for memory, collision setup.
    mCollisionConfiguration = new btDefaultCollisionConfiguration();
-
-   // TODO: There is something wrong with multithreading
-   // and compound convex shapes... so disable it for now.
-   static const U32 smMaxThreads = 1;
-
-   // Different initialization with threading enabled.
-   if ( smMaxThreads > 1 )
-   {
-	   
-	   // TODO: ifdef assumes smMaxThread is always one at this point. MACOSX support to be decided
-#ifdef WIN32
-      mThreadSupportCollision = new Win32ThreadSupport( 
-         Win32ThreadSupport::Win32ThreadConstructionInfo(   isServer ? "bt_servercol" : "bt_clientcol",
-								                                    processCollisionTask,
-								                                    createCollisionLocalStoreMemory,
-								                                    smMaxThreads ) );
-      
-      mDispatcher = new	SpuGatheringCollisionDispatcher( mThreadSupportCollision,
-                                                         smMaxThreads,
-                                                         mCollisionConfiguration );
-#endif // WIN32
-   }
-   else
-   {
-      mThreadSupportCollision = NULL;
-      mDispatcher = new	btCollisionDispatcher( mCollisionConfiguration );
-   }
+   mDispatcher = new	btCollisionDispatcher( mCollisionConfiguration );
   
    btVector3 worldMin( -2000, -2000, -1000 );
    btVector3 worldMax( 2000, 2000, 1000 );
@@ -134,7 +102,6 @@ void BtWorld::_destroy()
    SAFE_DELETE( mSolver );
    SAFE_DELETE( mBroadphase );
    SAFE_DELETE( mDispatcher );
-   SAFE_DELETE( mThreadSupportCollision );
    SAFE_DELETE( mCollisionConfiguration );
 }
 
@@ -144,12 +111,12 @@ void BtWorld::tickPhysics( U32 elapsedMs )
       return;
 
    // Did we forget to call getPhysicsResults somewhere?
-   AssertFatal( !mIsSimulating, "PhysXWorld::tickPhysics() - Already simulating!" );
+   AssertFatal( !mIsSimulating, "BtWorld::tickPhysics() - Already simulating!" );
 
    // The elapsed time should be non-zero and 
    // a multiple of TickMs!
    AssertFatal(   elapsedMs != 0 &&
-                  ( elapsedMs % TickMs ) == 0 , "PhysXWorld::tickPhysics() - Got bad elapsed time!" );
+                  ( elapsedMs % TickMs ) == 0 , "BtWorld::tickPhysics() - Got bad elapsed time!" );
 
    PROFILE_SCOPE(BtWorld_TickPhysics);
 

+ 0 - 2
Engine/source/T3D/physics/bullet/btWorld.h

@@ -37,7 +37,6 @@
 #endif
 
 class ProcessList;
-class btThreadSupportInterface;
 class PhysicsBody;
 
 
@@ -54,7 +53,6 @@ protected:
    btCollisionDispatcher *mDispatcher;
    btConstraintSolver *mSolver;
    btDefaultCollisionConfiguration *mCollisionConfiguration;
-  	btThreadSupportInterface *mThreadSupportCollision;
 
    bool mErrorReport;