made 'calculateLocalInertia' const, thanks to cgripeos, see http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=1514
- applied a large patch to remove warnings Thanks to Enrico, see http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=1568 - removed SSE includes, added #incude <string.h> for memset in Extras/quickstep, thanks Eternl Knight - disabled 16-byte alignement on btQuadWord class, it causes problems under PS3 Linux. Need to check out why.
This commit is contained in:
@@ -1,6 +1,13 @@
|
|||||||
Bullet Continuous Collision Detection and Physics Library
|
Bullet Continuous Collision Detection and Physics Library
|
||||||
Primary author and maintainer: Erwin Coumans
|
Primary author and maintainer: Erwin Coumans
|
||||||
|
|
||||||
|
2007 Oct 13
|
||||||
|
- made 'btCollisionShape::calculateLocalInertia' const
|
||||||
|
Thanks to cgripeos, see http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=1514
|
||||||
|
- applied a large patch to remove warnings
|
||||||
|
Thanks to Enrico, see http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=1568
|
||||||
|
- removed SSE includes, added #incude <string.h> for memset in Extras/quickstep, thanks Eternl Knight
|
||||||
|
|
||||||
2007 Oct 11
|
2007 Oct 11
|
||||||
- added Hashed Overlapping Pair Cache, recommended by Pierre Terdiman. It works like a charm, thanks Pierre and Erin Catto (code from Box2D)
|
- added Hashed Overlapping Pair Cache, recommended by Pierre Terdiman. It works like a charm, thanks Pierre and Erin Catto (code from Box2D)
|
||||||
- modified some margins inside btBoxShape, btCylinderShape and btSphereShape
|
- modified some margins inside btBoxShape, btCylinderShape and btSphereShape
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ int main(int argc,char** argv)
|
|||||||
|
|
||||||
BspDemo* bspDemo = new BspDemo();
|
BspDemo* bspDemo = new BspDemo();
|
||||||
|
|
||||||
char* bspfilename = "BspDemo.bsp";
|
const char* bspfilename = "BspDemo.bsp";
|
||||||
|
|
||||||
printf("argc=%i\n",argc);
|
printf("argc=%i\n",argc);
|
||||||
{
|
{
|
||||||
@@ -113,7 +113,8 @@ int main(int argc,char** argv)
|
|||||||
bspfilename = argv[1];
|
bspfilename = argv[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
bspDemo->initPhysics(bspfilename);
|
// Enrico: TODO: Should change parameter type of initPhysics() to std::string or at least const char *
|
||||||
|
bspDemo->initPhysics((char*)bspfilename);
|
||||||
|
|
||||||
bspDemo->setCameraDistance(22.f);
|
bspDemo->setCameraDistance(22.f);
|
||||||
|
|
||||||
|
|||||||
@@ -340,7 +340,6 @@ drawDinosaur(void)
|
|||||||
|
|
||||||
{
|
{
|
||||||
plReal matrix[16];
|
plReal matrix[16];
|
||||||
plVector3 dinoWorldPos;
|
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
/* Translate the dinosaur to be at (0,8,0). */
|
/* Translate the dinosaur to be at (0,8,0). */
|
||||||
@@ -839,7 +838,7 @@ main(int argc, char **argv)
|
|||||||
plVector3 dinoPos;
|
plVector3 dinoPos;
|
||||||
plQuaternion childOrn,dinoOrient;
|
plQuaternion childOrn,dinoOrient;
|
||||||
|
|
||||||
void* user_data;
|
void* user_data=NULL;
|
||||||
|
|
||||||
physicsSdk = plNewBulletSdk();
|
physicsSdk = plNewBulletSdk();
|
||||||
dynamicsWorld = plCreateDynamicsWorld(physicsSdk);
|
dynamicsWorld = plCreateDynamicsWorld(physicsSdk);
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ int main(int argc,char** argv)
|
|||||||
|
|
||||||
/// Import Collada 1.4 Physics objects
|
/// Import Collada 1.4 Physics objects
|
||||||
/// also can pass filename in as argument
|
/// also can pass filename in as argument
|
||||||
char* filename = "jenga.dae";
|
const char* filename = "jenga.dae";
|
||||||
printf("argc=%i\n",argc);
|
printf("argc=%i\n",argc);
|
||||||
{
|
{
|
||||||
for (int i=0;i<argc;i++)
|
for (int i=0;i<argc;i++)
|
||||||
|
|||||||
@@ -228,7 +228,6 @@ void ConcaveDemo::initPhysics()
|
|||||||
int buffersize = size+btOptimizedBvh::getAlignmentSerializationPadding();
|
int buffersize = size+btOptimizedBvh::getAlignmentSerializationPadding();
|
||||||
|
|
||||||
void* buffer = btAlignedAlloc(buffersize,16);
|
void* buffer = btAlignedAlloc(buffersize,16);
|
||||||
//memset(buffer,0xcc,size);
|
|
||||||
int read = fread(buffer,1,size,file);
|
int read = fread(buffer,1,size,file);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
bool swapEndian = false;
|
bool swapEndian = false;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ GLDebugDrawer debugDrawer;
|
|||||||
|
|
||||||
int main(int argc,char** argv)
|
int main(int argc,char** argv)
|
||||||
{
|
{
|
||||||
char* filename = "file.obj";
|
const char* filename = "file.obj";
|
||||||
|
|
||||||
|
|
||||||
ConvexDecompositionDemo* convexDecompDemo = new ConvexDecompositionDemo();
|
ConvexDecompositionDemo* convexDecompDemo = new ConvexDecompositionDemo();
|
||||||
|
|||||||
@@ -675,8 +675,8 @@ static void RenderCallback()
|
|||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
float RefDMin;
|
btVector3 RefSep(btScalar(0.), btScalar(0.), btScalar(0.));
|
||||||
btVector3 RefSep;
|
float RefDMin=0.f;
|
||||||
bool RefResult = false;
|
bool RefResult = false;
|
||||||
if(gRefMode)
|
if(gRefMode)
|
||||||
RefResult = ReferenceCode(gConvex0, gConvex1, RefDMin, RefSep);
|
RefResult = ReferenceCode(gConvex0, gConvex1, RefDMin, RefSep);
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ SubInclude TOP Demos BspDemo ;
|
|||||||
SubInclude TOP Demos BasicDemo ;
|
SubInclude TOP Demos BasicDemo ;
|
||||||
SubInclude TOP Demos ConvexDecompositionDemo ;
|
SubInclude TOP Demos ConvexDecompositionDemo ;
|
||||||
SubInclude TOP Demos ColladaDemo ;
|
SubInclude TOP Demos ColladaDemo ;
|
||||||
SubInclude TOP Demos BspDemo ;
|
|
||||||
SubInclude TOP Demos VehicleDemo ;
|
SubInclude TOP Demos VehicleDemo ;
|
||||||
SubInclude TOP Demos CollisionDemo ;
|
SubInclude TOP Demos CollisionDemo ;
|
||||||
SubInclude TOP Demos CollisionInterfaceDemo ;
|
SubInclude TOP Demos CollisionInterfaceDemo ;
|
||||||
@@ -54,5 +53,4 @@ SubInclude TOP Demos GjkConvexCastDemo ;
|
|||||||
SubInclude TOP Demos Raytracer ;
|
SubInclude TOP Demos Raytracer ;
|
||||||
SubInclude TOP Demos SimplexDemo ;
|
SubInclude TOP Demos SimplexDemo ;
|
||||||
SubInclude TOP Demos DoublePrecisionDemo ;
|
SubInclude TOP Demos DoublePrecisionDemo ;
|
||||||
SubInclude TOP Demos RagdollDemo ;
|
|
||||||
|
|
||||||
|
|||||||
@@ -321,10 +321,10 @@ void GL_ShapeDrawer::drawOpenGL(btScalar* m, const btCollisionShape* shape, cons
|
|||||||
const btConvexShape* convexShape = scalingShape->getChildShape();
|
const btConvexShape* convexShape = scalingShape->getChildShape();
|
||||||
float scalingFactor = (float)scalingShape->getUniformScalingFactor();
|
float scalingFactor = (float)scalingShape->getUniformScalingFactor();
|
||||||
{
|
{
|
||||||
btScalar tmpScaling[4][4]={scalingFactor,0,0,0,
|
btScalar tmpScaling[4][4]={{scalingFactor,0,0,0},
|
||||||
0,scalingFactor,0,0,
|
{0,scalingFactor,0,0},
|
||||||
0,0,scalingFactor,0,
|
{0,0,scalingFactor,0},
|
||||||
0,0,0,1};
|
{0,0,0,1}};
|
||||||
|
|
||||||
drawOpenGL( (btScalar*)tmpScaling,convexShape,color,debugMode);
|
drawOpenGL( (btScalar*)tmpScaling,convexShape,color,debugMode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,10 +28,19 @@ Written by: Marten Svanfeldt
|
|||||||
|
|
||||||
GLDebugDrawer debugDrawer;
|
GLDebugDrawer debugDrawer;
|
||||||
|
|
||||||
#define M_PI 3.14159265358979323846
|
// Enrico: Shouldn't these three variables be real constants and not defines?
|
||||||
#define M_PI_2 1.57079632679489661923
|
|
||||||
#define M_PI_4 0.785398163397448309616
|
|
||||||
|
|
||||||
|
#ifndef M_PI
|
||||||
|
#define M_PI 3.14159265358979323846
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef M_PI_2
|
||||||
|
#define M_PI_2 1.57079632679489661923
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef M_PI_4
|
||||||
|
#define M_PI_4 0.785398163397448309616
|
||||||
|
#endif
|
||||||
|
|
||||||
class RagDoll
|
class RagDoll
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -486,9 +486,9 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//! Calculates the exact inertia tensor for this shape
|
//! Calculates the exact inertia tensor for this shape
|
||||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||||
|
|
||||||
virtual char* getName()const
|
virtual const char* getName()const
|
||||||
{
|
{
|
||||||
return "GImpactCompound";
|
return "GImpactCompound";
|
||||||
}
|
}
|
||||||
@@ -790,12 +790,12 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual char* getName()const
|
virtual const char* getName()const
|
||||||
{
|
{
|
||||||
return "GImpactMeshShapePart";
|
return "GImpactMeshShapePart";
|
||||||
}
|
}
|
||||||
@@ -922,7 +922,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int getMeshPartCount()
|
int getMeshPartCount() const
|
||||||
{
|
{
|
||||||
return m_mesh_parts.size();
|
return m_mesh_parts.size();
|
||||||
}
|
}
|
||||||
@@ -981,7 +981,7 @@ public:
|
|||||||
m_needs_update = true;
|
m_needs_update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||||
|
|
||||||
|
|
||||||
//! Obtains the primitive manager
|
//! Obtains the primitive manager
|
||||||
@@ -1091,7 +1091,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual char* getName()const
|
virtual const char* getName()const
|
||||||
{
|
{
|
||||||
return "GImpactMesh";
|
return "GImpactMesh";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ subject to the following restrictions:
|
|||||||
|
|
||||||
#define CALC_EXACT_INERTIA 1
|
#define CALC_EXACT_INERTIA 1
|
||||||
|
|
||||||
void btGImpactCompoundShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
void btGImpactCompoundShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||||
{
|
{
|
||||||
lockChildShapes();
|
lockChildShapes();
|
||||||
#ifdef CALC_EXACT_INERTIA
|
#ifdef CALC_EXACT_INERTIA
|
||||||
@@ -69,7 +69,7 @@ void btGImpactCompoundShape::calculateLocalInertia(btScalar mass,btVector3& iner
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void btGImpactMeshShapePart::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
void btGImpactMeshShapePart::calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||||
{
|
{
|
||||||
lockChildShapes();
|
lockChildShapes();
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ void btGImpactMeshShapePart::calculateLocalInertia(btScalar mass,btVector3& iner
|
|||||||
unlockChildShapes();
|
unlockChildShapes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void btGImpactMeshShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
void btGImpactMeshShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef CALC_EXACT_INERTIA
|
#ifdef CALC_EXACT_INERTIA
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ if $(GLUT.AVAILABLE) = "yes"
|
|||||||
"../../Demos/OpenGL"
|
"../../Demos/OpenGL"
|
||||||
;
|
;
|
||||||
|
|
||||||
ExternalLibs GPUphysics : GLUT GLEW ;
|
ExternalLibs GPUphysics : GLUT GLew ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -165,32 +165,8 @@ inline void dSetValue1 (btScalar *a, int n, btScalar value)
|
|||||||
|
|
||||||
/// This macros are for MSVC and XCode compilers. Remotion.
|
/// This macros are for MSVC and XCode compilers. Remotion.
|
||||||
|
|
||||||
#if _MSC_VER //Visual Studio Win32, Win64
|
|
||||||
#include <xmmintrin.h> // SSE
|
|
||||||
#include <emmintrin.h> // SSE2
|
|
||||||
#include <intrin.h> // SSE3
|
|
||||||
|
|
||||||
#define __USE_SSE__
|
|
||||||
|
|
||||||
/*
|
|
||||||
#ifdef _WIN64
|
|
||||||
typedef unsigned __int64 size_t;
|
|
||||||
#else
|
|
||||||
typedef unsigned int size_t;
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
#elif __GNUC__ // XCode GCC
|
|
||||||
#if defined(__ppc__) || defined(__ppc64__) // Mac PPC
|
|
||||||
///PPC or PPC64 Mac no SSE support
|
|
||||||
#elif defined(__i386__) // Intel Mac with SSE support
|
|
||||||
#include <xmmintrin.h> // SSE
|
|
||||||
#include <emmintrin.h> // SSE2
|
|
||||||
#include <pmmintrin.h> // SSE3
|
|
||||||
#define __USE_SSE__
|
|
||||||
#endif
|
|
||||||
#include <string.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#include <string.h> //for memset
|
||||||
|
|
||||||
//Remotion: 10.10.2007
|
//Remotion: 10.10.2007
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -206,11 +206,11 @@ void btAxisSweep3Internal<BP_FP_INT_TYPE>::setAabb(btBroadphaseProxy* proxy,cons
|
|||||||
|
|
||||||
template <typename BP_FP_INT_TYPE>
|
template <typename BP_FP_INT_TYPE>
|
||||||
btAxisSweep3Internal<BP_FP_INT_TYPE>::btAxisSweep3Internal(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel,BP_FP_INT_TYPE maxHandles, btOverlappingPairCache* pairCache )
|
btAxisSweep3Internal<BP_FP_INT_TYPE>::btAxisSweep3Internal(const btPoint3& worldAabbMin,const btPoint3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel,BP_FP_INT_TYPE maxHandles, btOverlappingPairCache* pairCache )
|
||||||
:m_invalidPair(0),
|
:m_bpHandleMask(handleMask),
|
||||||
|
m_handleSentinel(handleSentinel),
|
||||||
m_pairCache(pairCache),
|
m_pairCache(pairCache),
|
||||||
m_ownsPairCache(false),
|
m_ownsPairCache(false),
|
||||||
m_bpHandleMask(handleMask),
|
m_invalidPair(0)
|
||||||
m_handleSentinel(handleSentinel)
|
|
||||||
{
|
{
|
||||||
if (!m_pairCache)
|
if (!m_pairCache)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ subject to the following restrictions:
|
|||||||
extern int gOverlappingPairs;
|
extern int gOverlappingPairs;
|
||||||
|
|
||||||
btMultiSapBroadphase::btMultiSapBroadphase(int maxProxies,btOverlappingPairCache* pairCache)
|
btMultiSapBroadphase::btMultiSapBroadphase(int maxProxies,btOverlappingPairCache* pairCache)
|
||||||
:m_invalidPair(0),
|
:m_overlappingPairs(pairCache),
|
||||||
m_ownsPairCache(false),
|
m_ownsPairCache(false),
|
||||||
m_overlappingPairs(pairCache)
|
m_invalidPair(0)
|
||||||
{
|
{
|
||||||
if (!m_overlappingPairs)
|
if (!m_overlappingPairs)
|
||||||
{
|
{
|
||||||
@@ -112,10 +112,10 @@ void btMultiSapBroadphase::calculateOverlappingPairs(btDispatcher* dispatcher)
|
|||||||
{
|
{
|
||||||
m_simpleBroadphase->calculateOverlappingPairs(dispatcher);
|
m_simpleBroadphase->calculateOverlappingPairs(dispatcher);
|
||||||
|
|
||||||
btBroadphasePairArray& overlappingPairArray = m_overlappingPairs->getOverlappingPairArray();
|
|
||||||
|
|
||||||
#ifndef USE_HASH_PAIRCACHE
|
#ifndef USE_HASH_PAIRCACHE
|
||||||
|
|
||||||
|
btBroadphasePairArray& overlappingPairArray = m_overlappingPairs->getOverlappingPairArray();
|
||||||
|
|
||||||
//perform a sort, to find duplicates and to sort 'invalid' pairs to the end
|
//perform a sort, to find duplicates and to sort 'invalid' pairs to the end
|
||||||
overlappingPairArray.heapSort(btBroadphasePairSortPredicate());
|
overlappingPairArray.heapSort(btBroadphasePairSortPredicate());
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ int gAddedPairs =0;
|
|||||||
int gFindPairs =0;
|
int gFindPairs =0;
|
||||||
|
|
||||||
btOverlappingPairCache::btOverlappingPairCache():
|
btOverlappingPairCache::btOverlappingPairCache():
|
||||||
m_blockedForChanges(false),
|
m_overlapFilterCallback(0),
|
||||||
m_overlapFilterCallback(0)
|
m_blockedForChanges(false)
|
||||||
{
|
{
|
||||||
int initialAllocatedSize= 2;
|
int initialAllocatedSize= 2;
|
||||||
m_overlappingPairArray.reserve(initialAllocatedSize);
|
m_overlappingPairArray.reserve(initialAllocatedSize);
|
||||||
@@ -164,7 +164,6 @@ void btOverlappingPairCache::growTables()
|
|||||||
{
|
{
|
||||||
//grow hashtable and next table
|
//grow hashtable and next table
|
||||||
int curHashtableSize = m_hashTable.size();
|
int curHashtableSize = m_hashTable.size();
|
||||||
int curNextTableSize = m_next.size();
|
|
||||||
|
|
||||||
m_hashTable.resize(newCapacity);
|
m_hashTable.resize(newCapacity);
|
||||||
m_next.resize(newCapacity);
|
m_next.resize(newCapacity);
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ void btSimpleBroadphase::validate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
btSimpleBroadphase::btSimpleBroadphase(int maxProxies, btOverlappingPairCache* overlappingPairCache)
|
btSimpleBroadphase::btSimpleBroadphase(int maxProxies, btOverlappingPairCache* overlappingPairCache)
|
||||||
:m_invalidPair(0),
|
:m_pairCache(overlappingPairCache),
|
||||||
m_pairCache(overlappingPairCache),
|
m_ownsPairCache(false),
|
||||||
m_ownsPairCache(false)
|
m_invalidPair(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!overlappingPairCache)
|
if (!overlappingPairCache)
|
||||||
@@ -129,8 +129,6 @@ protected:
|
|||||||
void btSimpleBroadphase::destroyProxy(btBroadphaseProxy* proxyOrg,btDispatcher* dispatcher)
|
void btSimpleBroadphase::destroyProxy(btBroadphaseProxy* proxyOrg,btDispatcher* dispatcher)
|
||||||
{
|
{
|
||||||
|
|
||||||
int i;
|
|
||||||
|
|
||||||
btSimpleBroadphaseProxy* proxy0 = static_cast<btSimpleBroadphaseProxy*>(proxyOrg);
|
btSimpleBroadphaseProxy* proxy0 = static_cast<btSimpleBroadphaseProxy*>(proxyOrg);
|
||||||
freeHandle(proxy0);
|
freeHandle(proxy0);
|
||||||
|
|
||||||
|
|||||||
@@ -43,3 +43,4 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif //BT_COLLISION_CONFIGURATION
|
#endif //BT_COLLISION_CONFIGURATION
|
||||||
|
|
||||||
|
|||||||
@@ -13,12 +13,15 @@ subject to the following restrictions:
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "btCollisionObject.h"
|
#include "btCollisionObject.h"
|
||||||
|
|
||||||
btCollisionObject::btCollisionObject()
|
btCollisionObject::btCollisionObject()
|
||||||
: m_broadphaseHandle(0),
|
: m_broadphaseHandle(0),
|
||||||
m_collisionShape(0),
|
m_collisionShape(0),
|
||||||
m_collisionFlags(0),
|
m_collisionFlags(0),
|
||||||
|
m_islandTag1(-1),
|
||||||
|
m_companionId(-1),
|
||||||
m_activationState1(1),
|
m_activationState1(1),
|
||||||
m_deactivationTime(btScalar(0.)),
|
m_deactivationTime(btScalar(0.)),
|
||||||
m_userObjectPointer(0),
|
m_userObjectPointer(0),
|
||||||
@@ -26,9 +29,7 @@ btCollisionObject::btCollisionObject()
|
|||||||
m_hitFraction(btScalar(1.)),
|
m_hitFraction(btScalar(1.)),
|
||||||
m_ccdSweptSphereRadius(btScalar(0.)),
|
m_ccdSweptSphereRadius(btScalar(0.)),
|
||||||
m_ccdSquareMotionThreshold(btScalar(0.)),
|
m_ccdSquareMotionThreshold(btScalar(0.)),
|
||||||
m_checkCollideWith(false),
|
m_checkCollideWith(false)
|
||||||
m_islandTag1(-1),
|
|
||||||
m_companionId(-1)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,3 +79,4 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif //BT_DEFAULT_COLLISION_CONFIGURATION
|
#endif //BT_DEFAULT_COLLISION_CONFIGURATION
|
||||||
|
|
||||||
|
|||||||
@@ -216,6 +216,10 @@ btScalar btSphereBoxCollisionAlgorithm::getSpherePenetration( btCollisionObject*
|
|||||||
btVector3 p0, tmp, prel, n[6], normal;
|
btVector3 p0, tmp, prel, n[6], normal;
|
||||||
btScalar fSep = btScalar(-10000000.0), fSepThis;
|
btScalar fSep = btScalar(-10000000.0), fSepThis;
|
||||||
|
|
||||||
|
// set p0 and normal to a default value to shup up GCC
|
||||||
|
p0.setValue(btScalar(0.), btScalar(0.), btScalar(0.));
|
||||||
|
normal.setValue(btScalar(0.), btScalar(0.), btScalar(0.));
|
||||||
|
|
||||||
n[0].setValue( btScalar(-1.0), btScalar(0.0), btScalar(0.0) );
|
n[0].setValue( btScalar(-1.0), btScalar(0.0), btScalar(0.0) );
|
||||||
n[1].setValue( btScalar(0.0), btScalar(-1.0), btScalar(0.0) );
|
n[1].setValue( btScalar(0.0), btScalar(-1.0), btScalar(0.0) );
|
||||||
n[2].setValue( btScalar(0.0), btScalar(0.0), btScalar(-1.0) );
|
n[2].setValue( btScalar(0.0), btScalar(0.0), btScalar(-1.0) );
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ void btBoxShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabb
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void btBoxShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
void btBoxShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||||
{
|
{
|
||||||
//btScalar margin = btScalar(0.);
|
//btScalar margin = btScalar(0.);
|
||||||
btVector3 halfExtents = getHalfExtentsWithMargin();
|
btVector3 halfExtents = getHalfExtentsWithMargin();
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||||
|
|
||||||
virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
|
virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
|
||||||
{
|
{
|
||||||
@@ -279,7 +279,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//debugging
|
//debugging
|
||||||
virtual char* getName()const
|
virtual const char* getName()const
|
||||||
{
|
{
|
||||||
return "Box";
|
return "Box";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,9 @@ subject to the following restrictions:
|
|||||||
///Bvh Concave triangle mesh is a static-triangle mesh shape with Bounding Volume Hierarchy optimization.
|
///Bvh Concave triangle mesh is a static-triangle mesh shape with Bounding Volume Hierarchy optimization.
|
||||||
///Uses an interface to access the triangles to allow for sharing graphics/physics triangles.
|
///Uses an interface to access the triangles to allow for sharing graphics/physics triangles.
|
||||||
btBvhTriangleMeshShape::btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression, bool buildBvh)
|
btBvhTriangleMeshShape::btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression, bool buildBvh)
|
||||||
:btTriangleMeshShape(meshInterface),m_useQuantizedAabbCompression(useQuantizedAabbCompression),
|
:btTriangleMeshShape(meshInterface),
|
||||||
m_bvh(0),
|
m_bvh(0),
|
||||||
|
m_useQuantizedAabbCompression(useQuantizedAabbCompression),
|
||||||
m_ownsBvh(false)
|
m_ownsBvh(false)
|
||||||
{
|
{
|
||||||
//construct bvh from meshInterface
|
//construct bvh from meshInterface
|
||||||
@@ -44,8 +45,9 @@ m_ownsBvh(false)
|
|||||||
}
|
}
|
||||||
|
|
||||||
btBvhTriangleMeshShape::btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression,const btVector3& bvhAabbMin,const btVector3& bvhAabbMax,bool buildBvh)
|
btBvhTriangleMeshShape::btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression,const btVector3& bvhAabbMin,const btVector3& bvhAabbMax,bool buildBvh)
|
||||||
:btTriangleMeshShape(meshInterface),m_useQuantizedAabbCompression(useQuantizedAabbCompression),
|
:btTriangleMeshShape(meshInterface),
|
||||||
m_bvh(0),
|
m_bvh(0),
|
||||||
|
m_useQuantizedAabbCompression(useQuantizedAabbCompression),
|
||||||
m_ownsBvh(false)
|
m_ownsBvh(false)
|
||||||
{
|
{
|
||||||
//construct bvh from meshInterface
|
//construct bvh from meshInterface
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public:
|
|||||||
void partialRefitTree(const btVector3& aabbMin,const btVector3& aabbMax);
|
void partialRefitTree(const btVector3& aabbMin,const btVector3& aabbMax);
|
||||||
|
|
||||||
//debugging
|
//debugging
|
||||||
virtual char* getName()const {return "BVHTRIANGLEMESH";}
|
virtual const char* getName()const {return "BVHTRIANGLEMESH";}
|
||||||
|
|
||||||
|
|
||||||
virtual void setLocalScaling(const btVector3& scaling);
|
virtual void setLocalScaling(const btVector3& scaling);
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void btCapsuleShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
void btCapsuleShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||||
{
|
{
|
||||||
//as an approximation, take the inertia of the box that bounds the spheres
|
//as an approximation, take the inertia of the box that bounds the spheres
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public:
|
|||||||
btCapsuleShape(btScalar radius,btScalar height);
|
btCapsuleShape(btScalar radius,btScalar height);
|
||||||
|
|
||||||
///CollisionShape Interface
|
///CollisionShape Interface
|
||||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||||
|
|
||||||
/// btConvexShape Interface
|
/// btConvexShape Interface
|
||||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||||
@@ -38,7 +38,7 @@ public:
|
|||||||
|
|
||||||
virtual int getShapeType() const { return CAPSULE_SHAPE_PROXYTYPE; }
|
virtual int getShapeType() const { return CAPSULE_SHAPE_PROXYTYPE; }
|
||||||
|
|
||||||
virtual char* getName()const
|
virtual const char* getName()const
|
||||||
{
|
{
|
||||||
return "CapsuleShape";
|
return "CapsuleShape";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,11 +76,11 @@ public:
|
|||||||
virtual int getShapeType() const=0;
|
virtual int getShapeType() const=0;
|
||||||
virtual void setLocalScaling(const btVector3& scaling) =0;
|
virtual void setLocalScaling(const btVector3& scaling) =0;
|
||||||
virtual const btVector3& getLocalScaling() const =0;
|
virtual const btVector3& getLocalScaling() const =0;
|
||||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) = 0;
|
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const = 0;
|
||||||
|
|
||||||
|
|
||||||
//debugging support
|
//debugging support
|
||||||
virtual char* getName()const =0 ;
|
virtual const char* getName()const =0 ;
|
||||||
#endif //__SPU__
|
#endif //__SPU__
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ void btCompoundShape::getAabb(const btTransform& trans,btVector3& aabbMin,btVect
|
|||||||
aabbMax = center + extent;
|
aabbMax = center + extent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void btCompoundShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
void btCompoundShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||||
{
|
{
|
||||||
//approximation: take the inertia from the aabb for now
|
//approximation: take the inertia from the aabb for now
|
||||||
btTransform ident;
|
btTransform ident;
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public:
|
|||||||
return m_localScaling;
|
return m_localScaling;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||||
|
|
||||||
virtual int getShapeType() const { return COMPOUND_SHAPE_PROXYTYPE;}
|
virtual int getShapeType() const { return COMPOUND_SHAPE_PROXYTYPE;}
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ public:
|
|||||||
{
|
{
|
||||||
return m_collisionMargin;
|
return m_collisionMargin;
|
||||||
}
|
}
|
||||||
virtual char* getName()const
|
virtual const char* getName()const
|
||||||
{
|
{
|
||||||
return "Compound";
|
return "Compound";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public:
|
|||||||
btScalar getHeight() const { return m_height;}
|
btScalar getHeight() const { return m_height;}
|
||||||
|
|
||||||
|
|
||||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia)
|
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||||
{
|
{
|
||||||
btTransform identity;
|
btTransform identity;
|
||||||
identity.setIdentity();
|
identity.setIdentity();
|
||||||
@@ -72,7 +72,7 @@ public:
|
|||||||
|
|
||||||
virtual int getShapeType() const { return CONE_SHAPE_PROXYTYPE; }
|
virtual int getShapeType() const { return CONE_SHAPE_PROXYTYPE; }
|
||||||
|
|
||||||
virtual char* getName()const
|
virtual const char* getName()const
|
||||||
{
|
{
|
||||||
return "Cone";
|
return "Cone";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public:
|
|||||||
virtual int getShapeType()const { return CONVEX_HULL_SHAPE_PROXYTYPE; }
|
virtual int getShapeType()const { return CONVEX_HULL_SHAPE_PROXYTYPE; }
|
||||||
|
|
||||||
//debugging
|
//debugging
|
||||||
virtual char* getName()const {return "Convex";}
|
virtual const char* getName()const {return "Convex";}
|
||||||
|
|
||||||
|
|
||||||
virtual int getNumVertices() const;
|
virtual int getNumVertices() const;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ subject to the following restrictions:
|
|||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "btConvexInternalShape.h"
|
#include "btConvexInternalShape.h"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public:
|
|||||||
virtual int getShapeType()const { return CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE; }
|
virtual int getShapeType()const { return CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE; }
|
||||||
|
|
||||||
//debugging
|
//debugging
|
||||||
virtual char* getName()const {return "ConvexTrimesh";}
|
virtual const char* getName()const {return "ConvexTrimesh";}
|
||||||
|
|
||||||
virtual int getNumVertices() const;
|
virtual int getNumVertices() const;
|
||||||
virtual int getNumEdges() const;
|
virtual int getNumEdges() const;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//use box inertia
|
//use box inertia
|
||||||
// virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
// virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||||
|
|
||||||
virtual int getShapeType() const
|
virtual int getShapeType() const
|
||||||
{
|
{
|
||||||
@@ -78,7 +78,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//debugging
|
//debugging
|
||||||
virtual char* getName()const
|
virtual const char* getName()const
|
||||||
{
|
{
|
||||||
return "CylinderY";
|
return "CylinderY";
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@ public:
|
|||||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||||
|
|
||||||
//debugging
|
//debugging
|
||||||
virtual char* getName()const
|
virtual const char* getName()const
|
||||||
{
|
{
|
||||||
return "CylinderX";
|
return "CylinderX";
|
||||||
}
|
}
|
||||||
@@ -121,7 +121,7 @@ public:
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
//debugging
|
//debugging
|
||||||
virtual char* getName()const
|
virtual const char* getName()const
|
||||||
{
|
{
|
||||||
return "CylinderZ";
|
return "CylinderZ";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ void btEmptyShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aa
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void btEmptyShape::calculateLocalInertia(btScalar ,btVector3& )
|
void btEmptyShape::calculateLocalInertia(btScalar ,btVector3& ) const
|
||||||
{
|
{
|
||||||
btAssert(0);
|
btAssert(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,12 +49,12 @@ public:
|
|||||||
return m_localScaling;
|
return m_localScaling;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||||
|
|
||||||
virtual int getShapeType() const { return EMPTY_SHAPE_PROXYTYPE;}
|
virtual int getShapeType() const { return EMPTY_SHAPE_PROXYTYPE;}
|
||||||
|
|
||||||
|
|
||||||
virtual char* getName()const
|
virtual const char* getName()const
|
||||||
{
|
{
|
||||||
return "Empty";
|
return "Empty";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,15 +19,15 @@ subject to the following restrictions:
|
|||||||
|
|
||||||
|
|
||||||
btHeightfieldTerrainShape::btHeightfieldTerrainShape(int width,int length,void* heightfieldData,btScalar maxHeight,int upAxis,bool useFloatData,bool flipQuadEdges)
|
btHeightfieldTerrainShape::btHeightfieldTerrainShape(int width,int length,void* heightfieldData,btScalar maxHeight,int upAxis,bool useFloatData,bool flipQuadEdges)
|
||||||
:m_localScaling(btScalar(1.),btScalar(1.),btScalar(1.)),
|
:m_width(width),
|
||||||
m_width(width),
|
|
||||||
m_length(length),
|
m_length(length),
|
||||||
m_heightfieldDataUnknown(heightfieldData),
|
|
||||||
m_maxHeight(maxHeight),
|
m_maxHeight(maxHeight),
|
||||||
m_upAxis(upAxis),
|
m_heightfieldDataUnknown(heightfieldData),
|
||||||
m_useFloatData(useFloatData),
|
m_useFloatData(useFloatData),
|
||||||
m_flipQuadEdges(flipQuadEdges),
|
m_flipQuadEdges(flipQuadEdges),
|
||||||
m_useDiamondSubdivision(false)
|
m_useDiamondSubdivision(false),
|
||||||
|
m_upAxis(upAxis),
|
||||||
|
m_localScaling(btScalar(1.),btScalar(1.),btScalar(1.))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@@ -322,7 +322,7 @@ void btHeightfieldTerrainShape::processAllTriangles(btTriangleCallback* callback
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void btHeightfieldTerrainShape::calculateLocalInertia(btScalar ,btVector3& inertia)
|
void btHeightfieldTerrainShape::calculateLocalInertia(btScalar ,btVector3& inertia) const
|
||||||
{
|
{
|
||||||
//moving concave objects not supported
|
//moving concave objects not supported
|
||||||
|
|
||||||
|
|||||||
@@ -74,14 +74,14 @@ public:
|
|||||||
|
|
||||||
virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||||
|
|
||||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||||
|
|
||||||
virtual void setLocalScaling(const btVector3& scaling);
|
virtual void setLocalScaling(const btVector3& scaling);
|
||||||
|
|
||||||
virtual const btVector3& getLocalScaling() const;
|
virtual const btVector3& getLocalScaling() const;
|
||||||
|
|
||||||
//debugging
|
//debugging
|
||||||
virtual char* getName()const {return "HEIGHTFIELD";}
|
virtual const char* getName()const {return "HEIGHTFIELD";}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ btScalar btMinkowskiSumShape::getMargin() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void btMinkowskiSumShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
void btMinkowskiSumShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||||
{
|
{
|
||||||
(void)mass;
|
(void)mass;
|
||||||
btAssert(0);
|
btAssert(0);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public:
|
|||||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||||
|
|
||||||
|
|
||||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||||
|
|
||||||
void setTransformA(const btTransform& transA) { m_transA = transA;}
|
void setTransformA(const btTransform& transA) { m_transA = transA;}
|
||||||
void setTransformB(const btTransform& transB) { m_transB = transB;}
|
void setTransformB(const btTransform& transB) { m_transB = transB;}
|
||||||
@@ -53,7 +53,7 @@ public:
|
|||||||
const btConvexShape* getShapeA() const { return m_shapeA;}
|
const btConvexShape* getShapeA() const { return m_shapeA;}
|
||||||
const btConvexShape* getShapeB() const { return m_shapeB;}
|
const btConvexShape* getShapeB() const { return m_shapeB;}
|
||||||
|
|
||||||
virtual char* getName()const
|
virtual const char* getName()const
|
||||||
{
|
{
|
||||||
return "MinkowskiSum";
|
return "MinkowskiSum";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ btMultiSphereShape::btMultiSphereShape (const btVector3& inertiaHalfExtents,cons
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void btMultiSphereShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
void btMultiSphereShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||||
{
|
{
|
||||||
//as an approximation, take the inertia of the box that bounds the spheres
|
//as an approximation, take the inertia of the box that bounds the spheres
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public:
|
|||||||
btMultiSphereShape (const btVector3& inertiaHalfExtents,const btVector3* positions,const btScalar* radi,int numSpheres);
|
btMultiSphereShape (const btVector3& inertiaHalfExtents,const btVector3* positions,const btScalar* radi,int numSpheres);
|
||||||
|
|
||||||
///CollisionShape Interface
|
///CollisionShape Interface
|
||||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||||
|
|
||||||
/// btConvexShape Interface
|
/// btConvexShape Interface
|
||||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||||
@@ -63,7 +63,7 @@ public:
|
|||||||
|
|
||||||
virtual int getShapeType() const { return MULTI_SPHERE_SHAPE_PROXYTYPE; }
|
virtual int getShapeType() const { return MULTI_SPHERE_SHAPE_PROXYTYPE; }
|
||||||
|
|
||||||
virtual char* getName()const
|
virtual const char* getName()const
|
||||||
{
|
{
|
||||||
return "MultiSphere";
|
return "MultiSphere";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ subject to the following restrictions:
|
|||||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "btOptimizedBvh.h"
|
#include "btOptimizedBvh.h"
|
||||||
#include "btStridingMeshInterface.h"
|
#include "btStridingMeshInterface.h"
|
||||||
#include "LinearMath/btAabbUtil2.h"
|
#include "LinearMath/btAabbUtil2.h"
|
||||||
@@ -1178,5 +1177,6 @@ m_bvhAabbMin(self.m_bvhAabbMin),
|
|||||||
m_bvhAabbMax(self.m_bvhAabbMax),
|
m_bvhAabbMax(self.m_bvhAabbMax),
|
||||||
m_bvhQuantization(self.m_bvhQuantization)
|
m_bvhQuantization(self.m_bvhQuantization)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ subject to the following restrictions:
|
|||||||
#define OPTIMIZED_BVH_H
|
#define OPTIMIZED_BVH_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "LinearMath/btVector3.h"
|
#include "LinearMath/btVector3.h"
|
||||||
#include "LinearMath/btAlignedAllocator.h"
|
#include "LinearMath/btAlignedAllocator.h"
|
||||||
|
|
||||||
@@ -99,6 +100,11 @@ public:
|
|||||||
int m_subtreeSize;
|
int m_subtreeSize;
|
||||||
int m_padding[3];
|
int m_padding[3];
|
||||||
|
|
||||||
|
btBvhSubtreeInfo()
|
||||||
|
{
|
||||||
|
//memset(&m_padding[0], 0, sizeof(m_padding));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void setAabbFromQuantizeNode(const btQuantizedBvhNode& quantizedNode)
|
void setAabbFromQuantizeNode(const btQuantizedBvhNode& quantizedNode)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ void btPolyhedralConvexShape::batchedUnitVectorGetSupportingVertexWithoutMargin(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void btPolyhedralConvexShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
void btPolyhedralConvexShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||||
{
|
{
|
||||||
//not yet, return box inertia
|
//not yet, return box inertia
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public:
|
|||||||
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
|
||||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||||
|
|
||||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||||
|
|
||||||
|
|
||||||
inline void getNonvirtualAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax, btScalar margin) const
|
inline void getNonvirtualAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax, btScalar margin) const
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ void btSphereShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& a
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void btSphereShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
void btSphereShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||||
{
|
{
|
||||||
btScalar elem = btScalar(0.4) * mass * getMargin()*getMargin();
|
btScalar elem = btScalar(0.4) * mass * getMargin()*getMargin();
|
||||||
inertia.setValue(elem,elem,elem);
|
inertia.setValue(elem,elem,elem);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public:
|
|||||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||||
|
|
||||||
|
|
||||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||||
|
|
||||||
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ public:
|
|||||||
btScalar getRadius() const { return m_implicitShapeDimensions.getX() * m_localScaling.getX();}
|
btScalar getRadius() const { return m_implicitShapeDimensions.getX() * m_localScaling.getX();}
|
||||||
|
|
||||||
//debugging
|
//debugging
|
||||||
virtual char* getName()const {return "SPHERE";}
|
virtual const char* getName()const {return "SPHERE";}
|
||||||
|
|
||||||
virtual void setMargin(btScalar margin)
|
virtual void setMargin(btScalar margin)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ void btStaticPlaneShape::processAllTriangles(btTriangleCallback* callback,const
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void btStaticPlaneShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
void btStaticPlaneShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||||
{
|
{
|
||||||
(void)mass;
|
(void)mass;
|
||||||
|
|
||||||
|
|||||||
@@ -46,14 +46,14 @@ public:
|
|||||||
|
|
||||||
virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||||
|
|
||||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||||
|
|
||||||
virtual void setLocalScaling(const btVector3& scaling);
|
virtual void setLocalScaling(const btVector3& scaling);
|
||||||
virtual const btVector3& getLocalScaling() const;
|
virtual const btVector3& getLocalScaling() const;
|
||||||
|
|
||||||
|
|
||||||
//debugging
|
//debugging
|
||||||
virtual char* getName()const {return "STATICPLANE";}
|
virtual const char* getName()const {return "STATICPLANE";}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
///getName is for debugging
|
///getName is for debugging
|
||||||
virtual char* getName()const { return "btBU_Simplex1to4";}
|
virtual const char* getName()const { return "btBU_Simplex1to4";}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ void btTriangleMeshShape::processAllTriangles(btTriangleCallback* callback,const
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void btTriangleMeshShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
void btTriangleMeshShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||||
{
|
{
|
||||||
(void)mass;
|
(void)mass;
|
||||||
//moving concave objects not supported
|
//moving concave objects not supported
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public:
|
|||||||
|
|
||||||
virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
virtual void processAllTriangles(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
|
||||||
|
|
||||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||||
|
|
||||||
virtual void setLocalScaling(const btVector3& scaling);
|
virtual void setLocalScaling(const btVector3& scaling);
|
||||||
virtual const btVector3& getLocalScaling() const;
|
virtual const btVector3& getLocalScaling() const;
|
||||||
@@ -70,7 +70,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//debugging
|
//debugging
|
||||||
virtual char* getName()const {return "TRIANGLEMESH";}
|
virtual const char* getName()const {return "TRIANGLEMESH";}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public:
|
|||||||
planeSupport = m_vertices1[0];
|
planeSupport = m_vertices1[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia)
|
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||||
{
|
{
|
||||||
(void)mass;
|
(void)mass;
|
||||||
btAssert(0);
|
btAssert(0);
|
||||||
@@ -155,7 +155,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//debugging
|
//debugging
|
||||||
virtual char* getName()const
|
virtual const char* getName()const
|
||||||
{
|
{
|
||||||
return "Triangle";
|
return "Triangle";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ btVector3 btUniformScalingShape::localGetSupportingVertex(const btVector3& vec)c
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void btUniformScalingShape::calculateLocalInertia(btScalar mass,btVector3& inertia)
|
void btUniformScalingShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
|
||||||
{
|
{
|
||||||
|
|
||||||
///this linear upscaling is not realistic, but we don't deal with large mass ratios...
|
///this linear upscaling is not realistic, but we don't deal with large mass ratios...
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class btUniformScalingShape : public btConvexShape
|
|||||||
|
|
||||||
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
|
||||||
|
|
||||||
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia);
|
virtual void calculateLocalInertia(btScalar mass,btVector3& inertia) const;
|
||||||
|
|
||||||
btScalar getUniformScalingFactor() const
|
btScalar getUniformScalingFactor() const
|
||||||
{
|
{
|
||||||
@@ -54,7 +54,7 @@ class btUniformScalingShape : public btConvexShape
|
|||||||
return m_childConvexShape;
|
return m_childConvexShape;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual char* getName()const
|
virtual const char* getName()const
|
||||||
{
|
{
|
||||||
return "UniformScalingShape";
|
return "UniformScalingShape";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,8 +112,7 @@ bool btMinkowskiPenetrationDepthSolver::calcPenDepth(btSimplexSolverInterface& s
|
|||||||
|
|
||||||
//just take fixed number of orientation, and sample the penetration depth in that direction
|
//just take fixed number of orientation, and sample the penetration depth in that direction
|
||||||
btScalar minProj = btScalar(1e30);
|
btScalar minProj = btScalar(1e30);
|
||||||
btVector3 minNorm;
|
btVector3 minNorm(btScalar(0.), btScalar(0.), btScalar(0.));
|
||||||
btVector3 minVertex;
|
|
||||||
btVector3 minA,minB;
|
btVector3 minA,minB;
|
||||||
btVector3 seperatingAxisInA,seperatingAxisInB;
|
btVector3 seperatingAxisInA,seperatingAxisInB;
|
||||||
btVector3 pInA,qInB,pWorld,qWorld,w;
|
btVector3 pInA,qInB,pWorld,qWorld,w;
|
||||||
|
|||||||
@@ -206,7 +206,6 @@ void btConeTwistConstraint::solveConstraint(btScalar timeStep)
|
|||||||
btVector3 pivotBInW = m_rbB.getCenterOfMassTransform()*m_rbBFrame.getOrigin();
|
btVector3 pivotBInW = m_rbB.getCenterOfMassTransform()*m_rbBFrame.getOrigin();
|
||||||
|
|
||||||
btScalar tau = btScalar(0.3);
|
btScalar tau = btScalar(0.3);
|
||||||
btScalar damping = btScalar(1.);
|
|
||||||
|
|
||||||
//linear part
|
//linear part
|
||||||
if (!m_angularOnly)
|
if (!m_angularOnly)
|
||||||
|
|||||||
@@ -263,7 +263,6 @@ void btHingeConstraint::solveConstraint(btScalar timeStep)
|
|||||||
btVector3 pivotBInW = m_rbB.getCenterOfMassTransform()*m_rbBFrame.getOrigin();
|
btVector3 pivotBInW = m_rbB.getCenterOfMassTransform()*m_rbBFrame.getOrigin();
|
||||||
|
|
||||||
btScalar tau = btScalar(0.3);
|
btScalar tau = btScalar(0.3);
|
||||||
btScalar damping = btScalar(1.);
|
|
||||||
|
|
||||||
//linear part
|
//linear part
|
||||||
if (!m_angularOnly)
|
if (!m_angularOnly)
|
||||||
|
|||||||
@@ -73,3 +73,4 @@ ATTRIBUTE_ALIGNED16 (struct) btSolverBody
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif //BT_SOLVER_BODY_H
|
#endif //BT_SOLVER_BODY_H
|
||||||
|
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ subject to the following restrictions:
|
|||||||
static btRigidBody s_fixed(0, 0,0);
|
static btRigidBody s_fixed(0, 0,0);
|
||||||
|
|
||||||
btTypedConstraint::btTypedConstraint(btTypedConstraintType type)
|
btTypedConstraint::btTypedConstraint(btTypedConstraintType type)
|
||||||
: m_constraintType (type),
|
:m_userConstraintType(-1),
|
||||||
m_userConstraintType(-1),
|
|
||||||
m_userConstraintId(-1),
|
m_userConstraintId(-1),
|
||||||
|
m_constraintType (type),
|
||||||
m_rbA(s_fixed),
|
m_rbA(s_fixed),
|
||||||
m_rbB(s_fixed),
|
m_rbB(s_fixed),
|
||||||
m_appliedImpulse(btScalar(0.))
|
m_appliedImpulse(btScalar(0.))
|
||||||
@@ -30,9 +30,9 @@ m_appliedImpulse(btScalar(0.))
|
|||||||
s_fixed.setMassProps(btScalar(0.),btVector3(btScalar(0.),btScalar(0.),btScalar(0.)));
|
s_fixed.setMassProps(btScalar(0.),btVector3(btScalar(0.),btScalar(0.),btScalar(0.)));
|
||||||
}
|
}
|
||||||
btTypedConstraint::btTypedConstraint(btTypedConstraintType type, btRigidBody& rbA)
|
btTypedConstraint::btTypedConstraint(btTypedConstraintType type, btRigidBody& rbA)
|
||||||
: m_constraintType (type),
|
:m_userConstraintType(-1),
|
||||||
m_userConstraintType(-1),
|
|
||||||
m_userConstraintId(-1),
|
m_userConstraintId(-1),
|
||||||
|
m_constraintType (type),
|
||||||
m_rbA(rbA),
|
m_rbA(rbA),
|
||||||
m_rbB(s_fixed),
|
m_rbB(s_fixed),
|
||||||
m_appliedImpulse(btScalar(0.))
|
m_appliedImpulse(btScalar(0.))
|
||||||
@@ -43,9 +43,9 @@ m_appliedImpulse(btScalar(0.))
|
|||||||
|
|
||||||
|
|
||||||
btTypedConstraint::btTypedConstraint(btTypedConstraintType type, btRigidBody& rbA,btRigidBody& rbB)
|
btTypedConstraint::btTypedConstraint(btTypedConstraintType type, btRigidBody& rbA,btRigidBody& rbB)
|
||||||
: m_constraintType (type),
|
:m_userConstraintType(-1),
|
||||||
m_userConstraintType(-1),
|
|
||||||
m_userConstraintId(-1),
|
m_userConstraintId(-1),
|
||||||
|
m_constraintType (type),
|
||||||
m_rbA(rbA),
|
m_rbA(rbA),
|
||||||
m_rbB(rbB),
|
m_rbB(rbB),
|
||||||
m_appliedImpulse(btScalar(0.))
|
m_appliedImpulse(btScalar(0.))
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ void btContinuousDynamicsWorld::internalSingleStepSimulation( btScalar timeStep)
|
|||||||
|
|
||||||
///update aabbs information
|
///update aabbs information
|
||||||
updateAabbs();
|
updateAabbs();
|
||||||
static int frame=0;
|
//static int frame=0;
|
||||||
// printf("frame %d\n",frame++);
|
// printf("frame %d\n",frame++);
|
||||||
|
|
||||||
///apply gravity, predict motion
|
///apply gravity, predict motion
|
||||||
@@ -144,7 +144,6 @@ void btContinuousDynamicsWorld::updateTemporalAabbs(btScalar timeStep)
|
|||||||
{
|
{
|
||||||
body->getCollisionShape()->getAabb(m_collisionObjects[i]->getWorldTransform(),temporalAabbMin,temporalAabbMax);
|
body->getCollisionShape()->getAabb(m_collisionObjects[i]->getWorldTransform(),temporalAabbMin,temporalAabbMax);
|
||||||
const btVector3& linvel = body->getLinearVelocity();
|
const btVector3& linvel = body->getLinearVelocity();
|
||||||
const btVector3& angvel = body->getAngularVelocity();
|
|
||||||
|
|
||||||
//make the AABB temporal
|
//make the AABB temporal
|
||||||
float temporalAabbMaxx = temporalAabbMax.getX();
|
float temporalAabbMaxx = temporalAabbMax.getX();
|
||||||
|
|||||||
@@ -19,7 +19,10 @@ subject to the following restrictions:
|
|||||||
#include "btScalar.h"
|
#include "btScalar.h"
|
||||||
#include "btSimdMinMax.h"
|
#include "btSimdMinMax.h"
|
||||||
|
|
||||||
ATTRIBUTE_ALIGNED16(class) btQuadWordStorage
|
//ATTRIBUTE_ALIGNED16(class) btQuadWordStorage
|
||||||
|
//some issues under PS3 Linux with IBM 2.1 SDK, gcc compiler prevent from using aligned quadword. todo: look into this
|
||||||
|
|
||||||
|
class btQuadWordStorage
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
btScalar m_x;
|
btScalar m_x;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ subject to the following restrictions:
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
#if defined(__MINGW32__) || defined(__CYGWIN__) || (defined (_MSC_VER) && _MSC_VER < 1300)
|
#if defined(__MINGW32__) || defined(__CYGWIN__) || (defined (_MSC_VER) && _MSC_VER < 1300)
|
||||||
|
|
||||||
#define SIMD_FORCE_INLINE inline
|
#define SIMD_FORCE_INLINE inline
|
||||||
#define ATTRIBUTE_ALIGNED16(a) a
|
#define ATTRIBUTE_ALIGNED16(a) a
|
||||||
#define ATTRIBUTE_ALIGNED128(a) a
|
#define ATTRIBUTE_ALIGNED128(a) a
|
||||||
|
|||||||
Reference in New Issue
Block a user