use btAssert instead of assert
use __debugbreak for Windows MSVC asserts and asm volatile ("int3");\ on Mac OSX (__i386__ / __x86_64__)
This commit is contained in:
@@ -385,9 +385,9 @@ static bool TestSepAxis(const btVector3& sep_axis, const MyConvex& hull0, const
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
float d0 = Max0 - Min1;
|
float d0 = Max0 - Min1;
|
||||||
assert(d0>=0.0f);
|
btAssert(d0>=0.0f);
|
||||||
float d1 = Max1 - Min0;
|
float d1 = Max1 - Min0;
|
||||||
assert(d1>=0.0f);
|
btAssert(d1>=0.0f);
|
||||||
depth = d0<d1 ? d0:d1;
|
depth = d0<d1 ? d0:d1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,9 +88,9 @@ static bool TestSepAxis(const btConvexPolyhedron& hullA, const btConvexPolyhedro
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
btScalar d0 = Max0 - Min1;
|
btScalar d0 = Max0 - Min1;
|
||||||
assert(d0>=0.0f);
|
btAssert(d0>=0.0f);
|
||||||
btScalar d1 = Max1 - Min0;
|
btScalar d1 = Max1 - Min0;
|
||||||
assert(d1>=0.0f);
|
btAssert(d1>=0.0f);
|
||||||
depth = d0<d1 ? d0:d1;
|
depth = d0<d1 ? d0:d1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ btGpu3DGridBroadphase::btGpu3DGridBroadphase( btOverlappingPairCache* overlappin
|
|||||||
btGpu3DGridBroadphase::~btGpu3DGridBroadphase()
|
btGpu3DGridBroadphase::~btGpu3DGridBroadphase()
|
||||||
{
|
{
|
||||||
//btSimpleBroadphase will free memory of btSortedOverlappingPairCache, because m_ownsPairCache
|
//btSimpleBroadphase will free memory of btSortedOverlappingPairCache, because m_ownsPairCache
|
||||||
assert(m_bInitialized);
|
btAssert(m_bInitialized);
|
||||||
_finalize();
|
_finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ void btGpu3DGridBroadphase::_initialize( const btVector3& worldAabbMin,const btV
|
|||||||
|
|
||||||
m_LastLargeHandleIndex = -1;
|
m_LastLargeHandleIndex = -1;
|
||||||
|
|
||||||
assert(!m_bInitialized);
|
btAssert(!m_bInitialized);
|
||||||
// allocate host storage
|
// allocate host storage
|
||||||
m_hBodiesHash = new unsigned int[m_maxHandles * 2];
|
m_hBodiesHash = new unsigned int[m_maxHandles * 2];
|
||||||
memset(m_hBodiesHash, 0x00, m_maxHandles*2*sizeof(unsigned int));
|
memset(m_hBodiesHash, 0x00, m_maxHandles*2*sizeof(unsigned int));
|
||||||
@@ -175,7 +175,7 @@ void btGpu3DGridBroadphase::_initialize( const btVector3& worldAabbMin,const btV
|
|||||||
|
|
||||||
void btGpu3DGridBroadphase::_finalize()
|
void btGpu3DGridBroadphase::_finalize()
|
||||||
{
|
{
|
||||||
assert(m_bInitialized);
|
btAssert(m_bInitialized);
|
||||||
delete [] m_hBodiesHash;
|
delete [] m_hBodiesHash;
|
||||||
delete [] m_hCellStart;
|
delete [] m_hCellStart;
|
||||||
delete [] m_hPairBuffStartCurr;
|
delete [] m_hPairBuffStartCurr;
|
||||||
|
|||||||
@@ -807,7 +807,7 @@ length(const btQuaternion& q)
|
|||||||
|
|
||||||
/**@brief Return the angle between two quaternions*/
|
/**@brief Return the angle between two quaternions*/
|
||||||
SIMD_FORCE_INLINE btScalar
|
SIMD_FORCE_INLINE btScalar
|
||||||
angle(const btQuaternion& q1, const btQuaternion& q2)
|
btAngle(const btQuaternion& q1, const btQuaternion& q2)
|
||||||
{
|
{
|
||||||
return q1.angle(q2);
|
return q1.angle(q2);
|
||||||
}
|
}
|
||||||
@@ -875,4 +875,3 @@ shortestArcQuatNormalize2(btVector3& v0,btVector3& v1)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -85,9 +85,14 @@ inline int btGetVersion()
|
|||||||
|
|
||||||
#endif //__MINGW32__
|
#endif //__MINGW32__
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#ifdef BT_DEBUG
|
#ifdef BT_DEBUG
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include <stdio.h>
|
||||||
|
#define btAssert(x) { if(!(x)){printf("Assert "__FILE__ ":%u ("#x")\n", __LINE__);__debugbreak(); }}
|
||||||
|
#else//_MSC_VER
|
||||||
|
#include <assert.h>
|
||||||
#define btAssert assert
|
#define btAssert assert
|
||||||
|
#endif//_MSC_VER
|
||||||
#else
|
#else
|
||||||
#define btAssert(x)
|
#define btAssert(x)
|
||||||
#endif
|
#endif
|
||||||
@@ -190,10 +195,23 @@ inline int btGetVersion()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(DEBUG) || defined (_DEBUG)
|
#if defined(DEBUG) || defined (_DEBUG)
|
||||||
|
#if defined (__i386__) || defined (__x86_64__)
|
||||||
|
#include <stdio.h>
|
||||||
|
#define btAssert(x)\
|
||||||
|
{\
|
||||||
|
if(!(x))\
|
||||||
|
{\
|
||||||
|
printf("Assert %s in line %d, file %s\n",#x, __LINE__, __FILE__);\
|
||||||
|
asm volatile ("int3");\
|
||||||
|
}\
|
||||||
|
}
|
||||||
|
#else//defined (__i386__) || defined (__x86_64__)
|
||||||
#define btAssert assert
|
#define btAssert assert
|
||||||
#else
|
#end//defined (__i386__) || defined (__x86_64__)
|
||||||
#define btAssert(x)
|
|
||||||
#endif
|
#endif
|
||||||
|
#else//defined(DEBUG) || defined (_DEBUG)
|
||||||
|
#define btAssert(x)
|
||||||
|
#endif//defined(DEBUG) || defined (_DEBUG)
|
||||||
|
|
||||||
//btFullAssert is optional, slows down a lot
|
//btFullAssert is optional, slows down a lot
|
||||||
#define btFullAssert(x)
|
#define btFullAssert(x)
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ protected:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
intPtr = (int*)cp;
|
intPtr = (int*)cp;
|
||||||
assert(strncmp(cp, "TYPE", 4)==0); intPtr++;
|
btAssert(strncmp(cp, "TYPE", 4)==0); intPtr++;
|
||||||
|
|
||||||
if (!littleEndian)
|
if (!littleEndian)
|
||||||
*intPtr = btSwapEndian(*intPtr);
|
*intPtr = btSwapEndian(*intPtr);
|
||||||
@@ -284,7 +284,7 @@ protected:
|
|||||||
|
|
||||||
// Parse type lens
|
// Parse type lens
|
||||||
intPtr = (int*)cp;
|
intPtr = (int*)cp;
|
||||||
assert(strncmp(cp, "TLEN", 4)==0); intPtr++;
|
btAssert(strncmp(cp, "TLEN", 4)==0); intPtr++;
|
||||||
|
|
||||||
dataLen = (int)mTypes.size();
|
dataLen = (int)mTypes.size();
|
||||||
|
|
||||||
@@ -311,7 +311,7 @@ protected:
|
|||||||
|
|
||||||
intPtr = (int*)shtPtr;
|
intPtr = (int*)shtPtr;
|
||||||
cp = (char*)intPtr;
|
cp = (char*)intPtr;
|
||||||
assert(strncmp(cp, "STRC", 4)==0); intPtr++;
|
btAssert(strncmp(cp, "STRC", 4)==0); intPtr++;
|
||||||
|
|
||||||
if (!littleEndian)
|
if (!littleEndian)
|
||||||
*intPtr = btSwapEndian(*intPtr);
|
*intPtr = btSwapEndian(*intPtr);
|
||||||
|
|||||||
Reference in New Issue
Block a user