Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Coumans <blender@erwincoumans.com>2006-11-13 00:05:10 +0300
committerErwin Coumans <blender@erwincoumans.com>2006-11-13 00:05:10 +0300
commit3a1b7ece402001f2f93669a7b36c32f5e7827bab (patch)
treea91e600407b0709922b7df3fa2a53f380cf7eb76 /extern/bullet2/src/BulletCollision/CollisionDispatch
parent22d97b2e346e3cb3fc38704a0460e2dd4d9a0abb (diff)
updating Bullet 2.x with latest changes. The integration + C-API will follow at some stage.
Diffstat (limited to 'extern/bullet2/src/BulletCollision/CollisionDispatch')
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionCreateFunc.h4
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp19
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.cpp8
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.h204
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp44
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h2
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp42
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp47
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp49
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp8
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionDispatch/btManifoldResult.h6
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp54
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp10
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp10
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp8
15 files changed, 336 insertions, 179 deletions
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionCreateFunc.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionCreateFunc.h
index 6d499f508e9..1eaa4a0fd50 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionCreateFunc.h
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionCreateFunc.h
@@ -18,9 +18,9 @@ subject to the following restrictions:
#include <vector>
-typedef std::vector<struct btCollisionObject*> btCollisionObjectArray;
+typedef std::vector<class btCollisionObject*> btCollisionObjectArray;
class btCollisionAlgorithm;
-struct btCollisionObject;
+class btCollisionObject;
struct btCollisionAlgorithmConstructionInfo;
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp
index ebfccef9cb1..c9d21f2d9a3 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp
@@ -14,6 +14,7 @@ subject to the following restrictions:
*/
+
#include "btCollisionDispatcher.h"
@@ -34,8 +35,8 @@ int gNumManifold = 0;
btCollisionDispatcher::btCollisionDispatcher(bool noDefaultAlgorithms)
:m_useIslands(true),
-m_count(0),
m_convexConvexCreateFunc(0),
+m_count(0),
m_convexConcaveCreateFunc(0),
m_swappedConvexConcaveCreateFunc(0),
m_compoundCreateFunc(0),
@@ -54,7 +55,7 @@ m_emptyCreateFunc(0)
}
}
-
+
btCollisionDispatcher::btCollisionDispatcher ():
m_useIslands(true),
m_count(0)
@@ -150,7 +151,7 @@ btCollisionAlgorithm* btCollisionDispatcher::findAlgorithm(btCollisionObject* bo
btCollisionAlgorithmConstructionInfo ci;
ci.m_dispatcher = this;
ci.m_manifold = sharedManifold;
- btCollisionAlgorithm* algo = m_doubleDispatch[body0->m_collisionShape->getShapeType()][body1->m_collisionShape->getShapeType()]
+ btCollisionAlgorithm* algo = m_doubleDispatch[body0->getCollisionShape()->getShapeType()][body1->getCollisionShape()->getShapeType()]
->CreateCollisionAlgorithm(ci,body0,body1);
#else
btCollisionAlgorithm* algo = internalFindAlgorithm(body0,body1);
@@ -201,27 +202,27 @@ btCollisionAlgorithm* btCollisionDispatcher::internalFindAlgorithm(btCollisionOb
btCollisionAlgorithmConstructionInfo ci;
ci.m_dispatcher = this;
- if (body0->m_collisionShape->isConvex() && body1->m_collisionShape->isConvex() )
+ if (body0->getCollisionShape()->isConvex() && body1->getCollisionShape()->isConvex() )
{
return new btConvexConvexAlgorithm(sharedManifold,ci,body0,body1);
}
- if (body0->m_collisionShape->isConvex() && body1->m_collisionShape->isConcave())
+ if (body0->getCollisionShape()->isConvex() && body1->getCollisionShape()->isConcave())
{
return new btConvexConcaveCollisionAlgorithm(ci,body0,body1,false);
}
- if (body1->m_collisionShape->isConvex() && body0->m_collisionShape->isConcave())
+ if (body1->getCollisionShape()->isConvex() && body0->getCollisionShape()->isConcave())
{
return new btConvexConcaveCollisionAlgorithm(ci,body0,body1,true);
}
- if (body0->m_collisionShape->isCompound())
+ if (body0->getCollisionShape()->isCompound())
{
return new btCompoundCollisionAlgorithm(ci,body0,body1,false);
} else
{
- if (body1->m_collisionShape->isCompound())
+ if (body1->getCollisionShape()->isCompound())
{
return new btCompoundCollisionAlgorithm(ci,body0,body1,true);
}
@@ -257,7 +258,7 @@ bool btCollisionDispatcher::needsCollision(btCollisionObject* body0,btCollisionO
printf("warning btCollisionDispatcher::needsCollision: static-static collision!\n");
}
- if ((!body0->IsActive()) && (!body1->IsActive()))
+ if ((!body0->isActive()) && (!body1->isActive()))
needsCollision = false;
return needsCollision ;
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.cpp
index 4179bc47e82..9cd2828dcad 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.cpp
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.cpp
@@ -30,22 +30,22 @@ btCollisionObject::btCollisionObject()
}
-void btCollisionObject::SetActivationState(int newState)
+void btCollisionObject::setActivationState(int newState)
{
if ( (m_activationState1 != DISABLE_DEACTIVATION) && (m_activationState1 != DISABLE_SIMULATION))
m_activationState1 = newState;
}
-void btCollisionObject::ForceActivationState(int newState)
+void btCollisionObject::forceActivationState(int newState)
{
m_activationState1 = newState;
}
void btCollisionObject::activate()
{
- if (!(m_collisionFlags & (CF_STATIC_OBJECT|CF_KINEMATIC_OJBECT)))
+ if (!(m_collisionFlags & (CF_STATIC_OBJECT|CF_KINEMATIC_OBJECT)))
{
- SetActivationState(ACTIVE_TAG);
+ setActivationState(ACTIVE_TAG);
m_deactivationTime = 0.f;
}
}
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.h
index 5df3de489cd..b85534c1d15 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.h
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionObject.h
@@ -34,8 +34,11 @@ class btCollisionShape;
/// btCollisionObject can be used to manage collision detection objects.
/// btCollisionObject maintains all information that is needed for a collision detection: Shape, Transform and AABB proxy.
/// They can be added to the btCollisionWorld.
-struct btCollisionObject
+class btCollisionObject
{
+
+protected:
+
btTransform m_worldTransform;
btBroadphaseProxy* m_broadphaseHandle;
btCollisionShape* m_collisionShape;
@@ -48,15 +51,6 @@ struct btCollisionObject
btVector3 m_interpolationLinearVelocity;
btVector3 m_interpolationAngularVelocity;
-
- enum CollisionFlags
- {
- CF_STATIC_OBJECT= 1,
- CF_KINEMATIC_OJBECT= 2,
- CF_NO_CONTACT_RESPONSE = 4,
- CF_CUSTOM_MATERIAL_CALLBACK = 8,//this allows per-triangle material (friction/restitution)
- };
-
int m_collisionFlags;
int m_islandTag1;
@@ -66,7 +60,7 @@ struct btCollisionObject
btScalar m_friction;
btScalar m_restitution;
- ///users can point to their objects, m_userPointer is not used by Bullet
+ ///users can point to their objects, m_userPointer is not used by Bullet, see setUserPointer/getUserPointer
void* m_userObjectPointer;
///m_internalOwner is reserved to point to Bullet's btRigidBody. Don't use this, use m_userObjectPointer instead.
@@ -81,10 +75,21 @@ struct btCollisionObject
/// Don't do continuous collision detection if square motion (in one step) is less then m_ccdSquareMotionThreshold
float m_ccdSquareMotionThreshold;
+public:
+
+ enum CollisionFlags
+ {
+ CF_STATIC_OBJECT= 1,
+ CF_KINEMATIC_OBJECT= 2,
+ CF_NO_CONTACT_RESPONSE = 4,
+ CF_CUSTOM_MATERIAL_CALLBACK = 8,//this allows per-triangle material (friction/restitution)
+ };
+
+
inline bool mergesSimulationIslands() const
{
///static objects, kinematic and object without contact response don't merge islands
- return ((m_collisionFlags & (CF_STATIC_OBJECT | CF_KINEMATIC_OJBECT | CF_NO_CONTACT_RESPONSE) )==0);
+ return ((m_collisionFlags & (CF_STATIC_OBJECT | CF_KINEMATIC_OBJECT | CF_NO_CONTACT_RESPONSE) )==0);
}
@@ -94,12 +99,12 @@ struct btCollisionObject
inline bool isKinematicObject() const
{
- return (m_collisionFlags & CF_KINEMATIC_OJBECT) != 0;
+ return (m_collisionFlags & CF_KINEMATIC_OBJECT) != 0;
}
inline bool isStaticOrKinematicObject() const
{
- return (m_collisionFlags & (CF_KINEMATIC_OJBECT | CF_STATIC_OBJECT)) != 0 ;
+ return (m_collisionFlags & (CF_KINEMATIC_OBJECT | CF_STATIC_OBJECT)) != 0 ;
}
inline bool hasContactResponse() const {
@@ -107,27 +112,47 @@ struct btCollisionObject
}
-
-
btCollisionObject();
- void SetCollisionShape(btCollisionShape* collisionShape)
+ void setCollisionShape(btCollisionShape* collisionShape)
{
m_collisionShape = collisionShape;
}
- int GetActivationState() const { return m_activationState1;}
+ const btCollisionShape* getCollisionShape() const
+ {
+ return m_collisionShape;
+ }
+
+ btCollisionShape* getCollisionShape()
+ {
+ return m_collisionShape;
+ }
+
- void SetActivationState(int newState);
- void ForceActivationState(int newState);
+
+ int getActivationState() const { return m_activationState1;}
+
+ void setActivationState(int newState);
+
+ void setDeactivationTime(float time)
+ {
+ m_deactivationTime = time;
+ }
+ float getDeactivationTime() const
+ {
+ return m_deactivationTime;
+ }
+
+ void forceActivationState(int newState);
void activate();
- inline bool IsActive() const
+ inline bool isActive() const
{
- return ((GetActivationState() != ISLAND_SLEEPING) && (GetActivationState() != DISABLE_SIMULATION));
+ return ((getActivationState() != ISLAND_SLEEPING) && (getActivationState() != DISABLE_SIMULATION));
}
void setRestitution(float rest)
@@ -147,6 +172,141 @@ struct btCollisionObject
return m_friction;
}
+ ///reserved for Bullet internal usage
+ void* getInternalOwner()
+ {
+ return m_internalOwner;
+ }
+
+ const void* getInternalOwner() const
+ {
+ return m_internalOwner;
+ }
+
+ btTransform& getWorldTransform()
+ {
+ return m_worldTransform;
+ }
+
+ const btTransform& getWorldTransform() const
+ {
+ return m_worldTransform;
+ }
+
+ void setWorldTransform(const btTransform& worldTrans)
+ {
+ m_worldTransform = worldTrans;
+ }
+
+
+ btBroadphaseProxy* getBroadphaseHandle()
+ {
+ return m_broadphaseHandle;
+ }
+
+ const btBroadphaseProxy* getBroadphaseHandle() const
+ {
+ return m_broadphaseHandle;
+ }
+
+ void setBroadphaseHandle(btBroadphaseProxy* handle)
+ {
+ m_broadphaseHandle = handle;
+ }
+
+
+ const btTransform& getInterpolationWorldTransform() const
+ {
+ return m_interpolationWorldTransform;
+ }
+
+ btTransform& getInterpolationWorldTransform()
+ {
+ return m_interpolationWorldTransform;
+ }
+
+ void setInterpolationWorldTransform(const btTransform& trans)
+ {
+ m_interpolationWorldTransform = trans;
+ }
+
+
+ const btVector3& getInterpolationLinearVelocity() const
+ {
+ return m_interpolationLinearVelocity;
+ }
+
+ const btVector3& getInterpolationAngularVelocity() const
+ {
+ return m_interpolationAngularVelocity;
+ }
+
+ const int getIslandTag() const
+ {
+ return m_islandTag1;
+ }
+
+ void setIslandTag(int tag)
+ {
+ m_islandTag1 = tag;
+ }
+
+ const float getHitFraction() const
+ {
+ return m_hitFraction;
+ }
+
+ void setHitFraction(float hitFraction)
+ {
+ m_hitFraction = hitFraction;
+ }
+
+
+ const int getCollisionFlags() const
+ {
+ return m_collisionFlags;
+ }
+
+ void setCollisionFlags(int flags)
+ {
+ m_collisionFlags = flags;
+ }
+
+ ///Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
+ float getCcdSweptSphereRadius() const
+ {
+ return m_ccdSweptSphereRadius;
+ }
+
+ ///Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
+ void setCcdSweptSphereRadius(float radius)
+ {
+ m_ccdSweptSphereRadius = radius;
+ }
+
+ float getCcdSquareMotionThreshold() const
+ {
+ return m_ccdSquareMotionThreshold;
+ }
+
+
+ /// Don't do continuous collision detection if square motion (in one step) is less then m_ccdSquareMotionThreshold
+ void setCcdSquareMotionThreshold(float ccdSquareMotionThreshold)
+ {
+ m_ccdSquareMotionThreshold = ccdSquareMotionThreshold;
+ }
+
+ ///users can point to their objects, userPointer is not used by Bullet
+ void* getUserPointer() const
+ {
+ return m_userObjectPointer;
+ }
+
+ ///users can point to their objects, userPointer is not used by Bullet
+ void setUserPointer(void* userPointer)
+ {
+ m_userObjectPointer = userPointer;
+ }
};
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp
index e24a5c6a0b4..7edd3e8abfe 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp
@@ -40,6 +40,7 @@ m_ownsBroadphasePairCache(false)
{
}
+
btCollisionWorld::btCollisionWorld()
: m_dispatcher1(new btCollisionDispatcher()),
m_broadphasePairCache(new btSimpleBroadphase()),
@@ -60,7 +61,7 @@ btCollisionWorld::~btCollisionWorld()
{
btCollisionObject* collisionObject= (*i);
- btBroadphaseProxy* bp = collisionObject->m_broadphaseHandle;
+ btBroadphaseProxy* bp = collisionObject->getBroadphaseHandle();
if (bp)
{
//
@@ -98,21 +99,22 @@ void btCollisionWorld::addCollisionObject(btCollisionObject* collisionObject,sho
m_collisionObjects.push_back(collisionObject);
//calculate new AABB
- btTransform trans = collisionObject->m_worldTransform;
+ btTransform trans = collisionObject->getWorldTransform();
btVector3 minAabb;
btVector3 maxAabb;
- collisionObject->m_collisionShape->getAabb(trans,minAabb,maxAabb);
+ collisionObject->getCollisionShape()->getAabb(trans,minAabb,maxAabb);
- int type = collisionObject->m_collisionShape->getShapeType();
- collisionObject->m_broadphaseHandle = getBroadphase()->createProxy(
+ int type = collisionObject->getCollisionShape()->getShapeType();
+ collisionObject->setBroadphaseHandle( getBroadphase()->createProxy(
minAabb,
maxAabb,
type,
collisionObject,
collisionFilterGroup,
collisionFilterMask
- );
+ )) ;
+
@@ -132,8 +134,8 @@ void btCollisionWorld::performDiscreteCollisionDetection()
btVector3 aabbMin,aabbMax;
for (size_t i=0;i<m_collisionObjects.size();i++)
{
- m_collisionObjects[i]->m_collisionShape->getAabb(m_collisionObjects[i]->m_worldTransform,aabbMin,aabbMax);
- m_broadphasePairCache->setAabb(m_collisionObjects[i]->m_broadphaseHandle,aabbMin,aabbMax);
+ m_collisionObjects[i]->getCollisionShape()->getAabb(m_collisionObjects[i]->getWorldTransform(),aabbMin,aabbMax);
+ m_broadphasePairCache->setAabb(m_collisionObjects[i]->getBroadphaseHandle(),aabbMin,aabbMax);
}
m_broadphasePairCache->refreshOverlappingPairs();
@@ -155,7 +157,7 @@ void btCollisionWorld::removeCollisionObject(btCollisionObject* collisionObject)
{
- btBroadphaseProxy* bp = collisionObject->m_broadphaseHandle;
+ btBroadphaseProxy* bp = collisionObject->getBroadphaseHandle();
if (bp)
{
//
@@ -163,7 +165,7 @@ void btCollisionWorld::removeCollisionObject(btCollisionObject* collisionObject)
//
getBroadphase()->cleanProxyFromPairs(bp);
getBroadphase()->destroyProxy(bp);
- collisionObject->m_broadphaseHandle = 0;
+ collisionObject->setBroadphaseHandle(0);
}
}
@@ -318,15 +320,7 @@ void btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& r
rayToTrans.setOrigin(rayToWorld);
- //do culling based on aabb (rayFrom/rayTo)
- btVector3 rayAabbMin = rayFromWorld;
- btVector3 rayAabbMax = rayFromWorld;
- rayAabbMin.setMin(rayToWorld);
- rayAabbMax.setMax(rayToWorld);
-
-
- /// brute force go over all objects. Once there is a broadphase, use that, or
- /// add a raycast against aabb first.
+ /// go over all objects, and if the ray intersects their aabb, do a ray-shape query using convexCaster (CCD)
std::vector<btCollisionObject*>::iterator iter;
@@ -338,16 +332,16 @@ void btCollisionWorld::rayTest(const btVector3& rayFromWorld, const btVector3& r
//RigidcollisionObject* collisionObject = ctrl->GetRigidcollisionObject();
btVector3 collisionObjectAabbMin,collisionObjectAabbMax;
- collisionObject->m_collisionShape->getAabb(collisionObject->m_worldTransform,collisionObjectAabbMin,collisionObjectAabbMax);
-
- //check aabb overlap
+ collisionObject->getCollisionShape()->getAabb(collisionObject->getWorldTransform(),collisionObjectAabbMin,collisionObjectAabbMax);
- if (TestAabbAgainstAabb2(rayAabbMin,rayAabbMax,collisionObjectAabbMin,collisionObjectAabbMax))
+ float hitLambda = 1.f; //could use resultCallback.m_closestHitFraction, but needs testing
+ btVector3 hitNormal;
+ if (btRayAabb(rayFromWorld,rayToWorld,collisionObjectAabbMin,collisionObjectAabbMax,hitLambda,hitNormal))
{
rayTestSingle(rayFromTrans,rayToTrans,
collisionObject,
- collisionObject->m_collisionShape,
- collisionObject->m_worldTransform,
+ collisionObject->getCollisionShape(),
+ collisionObject->getWorldTransform(),
resultCallback);
}
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h
index a1cf3a0e5fd..e2b8eb11238 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.h
@@ -194,7 +194,7 @@ public:
m_closestHitFraction = rayResult.m_hitFraction;
m_collisionObject = rayResult.m_collisionObject;
- m_hitNormalWorld = m_collisionObject->m_worldTransform.getBasis()*rayResult.m_hitNormalLocal;
+ m_hitNormalWorld = m_collisionObject->getWorldTransform().getBasis()*rayResult.m_hitNormalLocal;
m_hitPointWorld.setInterpolate3(m_rayFromWorld,m_rayToWorld,rayResult.m_hitFraction);
return rayResult.m_hitFraction;
}
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp
index febd726b556..43887d26a45 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp
@@ -23,9 +23,9 @@ btCompoundCollisionAlgorithm::btCompoundCollisionAlgorithm( const btCollisionAlg
{
btCollisionObject* colObj = m_isSwapped? body1 : body0;
btCollisionObject* otherObj = m_isSwapped? body0 : body1;
- assert (colObj->m_collisionShape->isCompound());
+ assert (colObj->getCollisionShape()->isCompound());
- btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->m_collisionShape);
+ btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
int numChildren = compoundShape->getNumChildShapes();
int i;
@@ -33,10 +33,10 @@ btCompoundCollisionAlgorithm::btCompoundCollisionAlgorithm( const btCollisionAlg
for (i=0;i<numChildren;i++)
{
btCollisionShape* childShape = compoundShape->getChildShape(i);
- btCollisionShape* orgShape = colObj->m_collisionShape;
- colObj->m_collisionShape = childShape;
+ btCollisionShape* orgShape = colObj->getCollisionShape();
+ colObj->setCollisionShape( childShape );
m_childCollisionAlgorithms[i] = ci.m_dispatcher->findAlgorithm(colObj,otherObj);
- colObj->m_collisionShape =orgShape;
+ colObj->setCollisionShape( orgShape );
}
}
@@ -56,8 +56,8 @@ void btCompoundCollisionAlgorithm::processCollision (btCollisionObject* body0,bt
btCollisionObject* colObj = m_isSwapped? body1 : body0;
btCollisionObject* otherObj = m_isSwapped? body0 : body1;
- assert (colObj->m_collisionShape->isCompound());
- btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->m_collisionShape);
+ assert (colObj->getCollisionShape()->isCompound());
+ btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
//We will use the OptimizedBVH, AABB tree to cull potential child-overlaps
//If both proxies are Compound, we will deal with that directly, by performing sequential/parallel tree traversals
@@ -74,18 +74,18 @@ void btCompoundCollisionAlgorithm::processCollision (btCollisionObject* body0,bt
btCollisionShape* childShape = compoundShape->getChildShape(i);
//backup
- btTransform orgTrans = colObj->m_worldTransform;
- btCollisionShape* orgShape = colObj->m_collisionShape;
+ btTransform orgTrans = colObj->getWorldTransform();
+ btCollisionShape* orgShape = colObj->getCollisionShape();
btTransform childTrans = compoundShape->getChildTransform(i);
btTransform newChildWorldTrans = orgTrans*childTrans ;
- colObj->m_worldTransform = newChildWorldTrans;
+ colObj->setWorldTransform( newChildWorldTrans );
//the contactpoint is still projected back using the original inverted worldtrans
- colObj->m_collisionShape = childShape;
+ colObj->setCollisionShape( childShape );
m_childCollisionAlgorithms[i]->processCollision(colObj,otherObj,dispatchInfo,resultOut);
//revert back
- colObj->m_collisionShape =orgShape;
- colObj->m_worldTransform = orgTrans;
+ colObj->setCollisionShape( orgShape);
+ colObj->setWorldTransform( orgTrans );
}
}
@@ -95,9 +95,9 @@ float btCompoundCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject* bod
btCollisionObject* colObj = m_isSwapped? body1 : body0;
btCollisionObject* otherObj = m_isSwapped? body0 : body1;
- assert (colObj->m_collisionShape->isCompound());
+ assert (colObj->getCollisionShape()->isCompound());
- btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->m_collisionShape);
+ btCompoundShape* compoundShape = static_cast<btCompoundShape*>(colObj->getCollisionShape());
//We will use the OptimizedBVH, AABB tree to cull potential child-overlaps
//If both proxies are Compound, we will deal with that directly, by performing sequential/parallel tree traversals
@@ -116,22 +116,22 @@ float btCompoundCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject* bod
btCollisionShape* childShape = compoundShape->getChildShape(i);
//backup
- btTransform orgTrans = colObj->m_worldTransform;
- btCollisionShape* orgShape = colObj->m_collisionShape;
+ btTransform orgTrans = colObj->getWorldTransform();
+ btCollisionShape* orgShape = colObj->getCollisionShape();
btTransform childTrans = compoundShape->getChildTransform(i);
btTransform newChildWorldTrans = orgTrans*childTrans ;
- colObj->m_worldTransform = newChildWorldTrans;
+ colObj->setWorldTransform( newChildWorldTrans );
- colObj->m_collisionShape = childShape;
+ colObj->setCollisionShape( childShape );
float frac = m_childCollisionAlgorithms[i]->calculateTimeOfImpact(colObj,otherObj,dispatchInfo,resultOut);
if (frac<hitFraction)
{
hitFraction = frac;
}
//revert back
- colObj->m_collisionShape =orgShape;
- colObj->m_worldTransform = orgTrans;
+ colObj->setCollisionShape( orgShape);
+ colObj->setWorldTransform( orgTrans);
}
return hitFraction;
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp
index 7cb0bba6206..8ad3967bac2 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp
@@ -89,7 +89,7 @@ void btConvexTriangleCallback::processTriangle(btVector3* triangle,int partId, i
if (m_dispatchInfoPtr && m_dispatchInfoPtr->m_debugDraw && m_dispatchInfoPtr->m_debugDraw->getDebugMode() > 0)
{
btVector3 color(255,255,0);
- btTransform& tr = ob->m_worldTransform;
+ btTransform& tr = ob->getWorldTransform();
m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[0]),tr(triangle[1]),color);
m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[1]),tr(triangle[2]),color);
m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[2]),tr(triangle[0]),color);
@@ -105,14 +105,14 @@ void btConvexTriangleCallback::processTriangle(btVector3* triangle,int partId, i
//btCollisionObject* colObj = static_cast<btCollisionObject*>(m_convexProxy->m_clientObject);
- if (m_convexBody->m_collisionShape->isConvex())
+ if (m_convexBody->getCollisionShape()->isConvex())
{
btTriangleShape tm(triangle[0],triangle[1],triangle[2]);
tm.setMargin(m_collisionMarginTriangle);
- btCollisionShape* tmpShape = ob->m_collisionShape;
- ob->m_collisionShape = &tm;
+ btCollisionShape* tmpShape = ob->getCollisionShape();
+ ob->setCollisionShape( &tm );
btCollisionAlgorithm* colAlgo = ci.m_dispatcher->findAlgorithm(m_convexBody,m_triBody,m_manifoldPtr);
@@ -124,7 +124,7 @@ void btConvexTriangleCallback::processTriangle(btVector3* triangle,int partId, i
// cvxcvxalgo.processCollision(m_convexBody,m_triBody,*m_dispatchInfoPtr,m_resultOut);
colAlgo->processCollision(m_convexBody,m_triBody,*m_dispatchInfoPtr,m_resultOut);
delete colAlgo;
- ob->m_collisionShape = tmpShape;
+ ob->setCollisionShape( tmpShape );
}
@@ -142,8 +142,8 @@ void btConvexTriangleCallback::setTimeStepAndCounters(float collisionMarginTrian
//recalc aabbs
btTransform convexInTriangleSpace;
- convexInTriangleSpace = m_triBody->m_worldTransform.inverse() * m_convexBody->m_worldTransform;
- btCollisionShape* convexShape = static_cast<btCollisionShape*>(m_convexBody->m_collisionShape);
+ convexInTriangleSpace = m_triBody->getWorldTransform().inverse() * m_convexBody->getWorldTransform();
+ btCollisionShape* convexShape = static_cast<btCollisionShape*>(m_convexBody->getCollisionShape());
//CollisionShape* triangleShape = static_cast<btCollisionShape*>(triBody->m_collisionShape);
convexShape->getAabb(convexInTriangleSpace,m_aabbMin,m_aabbMax);
float extraMargin = collisionMarginTriangle;
@@ -167,14 +167,14 @@ void btConvexConcaveCollisionAlgorithm::processCollision (btCollisionObject* bod
btCollisionObject* convexBody = m_isSwapped ? body1 : body0;
btCollisionObject* triBody = m_isSwapped ? body0 : body1;
- if (triBody->m_collisionShape->isConcave())
+ if (triBody->getCollisionShape()->isConcave())
{
btCollisionObject* triOb = triBody;
- ConcaveShape* concaveShape = static_cast<ConcaveShape*>( triOb->m_collisionShape);
+ ConcaveShape* concaveShape = static_cast<ConcaveShape*>( triOb->getCollisionShape());
- if (convexBody->m_collisionShape->isConvex())
+ if (convexBody->getCollisionShape()->isConvex())
{
float collisionMarginTriangle = concaveShape->getMargin();
@@ -207,8 +207,8 @@ float btConvexConcaveCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject
//only perform CCD above a certain threshold, this prevents blocking on the long run
//because object in a blocked ccd state (hitfraction<1) get their linear velocity halved each frame...
- float squareMot0 = (convexbody->m_interpolationWorldTransform.getOrigin() - convexbody->m_worldTransform.getOrigin()).length2();
- if (squareMot0 < convexbody->m_ccdSquareMotionThreshold)
+ float squareMot0 = (convexbody->getInterpolationWorldTransform().getOrigin() - convexbody->getWorldTransform().getOrigin()).length2();
+ if (squareMot0 < convexbody->getCcdSquareMotionThreshold())
{
return 1.f;
}
@@ -217,9 +217,9 @@ float btConvexConcaveCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject
//btVector3 to = convexbody->m_interpolationWorldTransform.getOrigin();
//todo: only do if the motion exceeds the 'radius'
- btTransform triInv = triBody->m_worldTransform.inverse();
- btTransform convexFromLocal = triInv * convexbody->m_worldTransform;
- btTransform convexToLocal = triInv * convexbody->m_interpolationWorldTransform;
+ btTransform triInv = triBody->getWorldTransform().inverse();
+ btTransform convexFromLocal = triInv * convexbody->getWorldTransform();
+ btTransform convexToLocal = triInv * convexbody->getInterpolationWorldTransform();
struct LocalTriangleSphereCastCallback : public btTriangleCallback
{
@@ -270,24 +270,25 @@ float btConvexConcaveCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject
- if (triBody->m_collisionShape->isConcave())
+ if (triBody->getCollisionShape()->isConcave())
{
btVector3 rayAabbMin = convexFromLocal.getOrigin();
rayAabbMin.setMin(convexToLocal.getOrigin());
btVector3 rayAabbMax = convexFromLocal.getOrigin();
rayAabbMax.setMax(convexToLocal.getOrigin());
- rayAabbMin -= btVector3(convexbody->m_ccdSweptSphereRadius,convexbody->m_ccdSweptSphereRadius,convexbody->m_ccdSweptSphereRadius);
- rayAabbMax += btVector3(convexbody->m_ccdSweptSphereRadius,convexbody->m_ccdSweptSphereRadius,convexbody->m_ccdSweptSphereRadius);
+ float ccdRadius0 = convexbody->getCcdSweptSphereRadius();
+ rayAabbMin -= btVector3(ccdRadius0,ccdRadius0,ccdRadius0);
+ rayAabbMax += btVector3(ccdRadius0,ccdRadius0,ccdRadius0);
float curHitFraction = 1.f; //is this available?
LocalTriangleSphereCastCallback raycastCallback(convexFromLocal,convexToLocal,
- convexbody->m_ccdSweptSphereRadius,curHitFraction);
+ convexbody->getCcdSweptSphereRadius(),curHitFraction);
- raycastCallback.m_hitFraction = convexbody->m_hitFraction;
+ raycastCallback.m_hitFraction = convexbody->getHitFraction();
btCollisionObject* concavebody = triBody;
- ConcaveShape* triangleMesh = (ConcaveShape*) concavebody->m_collisionShape;
+ ConcaveShape* triangleMesh = (ConcaveShape*) concavebody->getCollisionShape();
if (triangleMesh)
{
@@ -296,9 +297,9 @@ float btConvexConcaveCollisionAlgorithm::calculateTimeOfImpact(btCollisionObject
- if (raycastCallback.m_hitFraction < convexbody->m_hitFraction)
+ if (raycastCallback.m_hitFraction < convexbody->getHitFraction())
{
- convexbody->m_hitFraction = raycastCallback.m_hitFraction;
+ convexbody->setHitFraction( raycastCallback.m_hitFraction);
return raycastCallback.m_hitFraction;
}
}
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp
index 5347ef05bef..36b0d15eac5 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp
@@ -157,8 +157,8 @@ void btConvexConvexAlgorithm ::processCollision (btCollisionObject* body0,btColl
checkPenetrationDepthSolver();
- btConvexShape* min0 = static_cast<btConvexShape*>(body0->m_collisionShape);
- btConvexShape* min1 = static_cast<btConvexShape*>(body1->m_collisionShape);
+ btConvexShape* min0 = static_cast<btConvexShape*>(body0->getCollisionShape());
+ btConvexShape* min1 = static_cast<btConvexShape*>(body1->getCollisionShape());
btGjkPairDetector::ClosestPointInput input;
@@ -170,8 +170,8 @@ void btConvexConvexAlgorithm ::processCollision (btCollisionObject* body0,btColl
// input.m_maximumDistanceSquared = 1e30f;
- input.m_transformA = body0->m_worldTransform;
- input.m_transformB = body1->m_worldTransform;
+ input.m_transformA = body0->getWorldTransform();
+ input.m_transformB = body1->getWorldTransform();
resultOut->setPersistentManifold(m_manifoldPtr);
m_gjkPairDetector.getClosestPoints(input,*resultOut,dispatchInfo.m_debugDraw);
@@ -190,14 +190,13 @@ float btConvexConvexAlgorithm::calculateTimeOfImpact(btCollisionObject* col0,btC
float resultFraction = 1.f;
- float squareMot0 = (col0->m_interpolationWorldTransform.getOrigin() - col0->m_worldTransform.getOrigin()).length2();
+ float squareMot0 = (col0->getInterpolationWorldTransform().getOrigin() - col0->getWorldTransform().getOrigin()).length2();
+ float squareMot1 = (col1->getInterpolationWorldTransform().getOrigin() - col1->getWorldTransform().getOrigin()).length2();
- if (squareMot0 < col0->m_ccdSquareMotionThreshold &&
- squareMot0 < col0->m_ccdSquareMotionThreshold)
+ if (squareMot0 < col0->getCcdSquareMotionThreshold() &&
+ squareMot1 < col1->getCcdSquareMotionThreshold())
return resultFraction;
-
-
if (disableCcd)
return 1.f;
@@ -212,26 +211,26 @@ float btConvexConvexAlgorithm::calculateTimeOfImpact(btCollisionObject* col0,btC
/// Convex0 against sphere for Convex1
{
- btConvexShape* convex0 = static_cast<btConvexShape*>(col0->m_collisionShape);
+ btConvexShape* convex0 = static_cast<btConvexShape*>(col0->getCollisionShape());
- btSphereShape sphere1(col1->m_ccdSweptSphereRadius); //todo: allow non-zero sphere sizes, for better approximation
+ btSphereShape sphere1(col1->getCcdSweptSphereRadius()); //todo: allow non-zero sphere sizes, for better approximation
btConvexCast::CastResult result;
btVoronoiSimplexSolver voronoiSimplex;
//SubsimplexConvexCast ccd0(&sphere,min0,&voronoiSimplex);
///Simplification, one object is simplified as a sphere
btGjkConvexCast ccd1( convex0 ,&sphere1,&voronoiSimplex);
//ContinuousConvexCollision ccd(min0,min1,&voronoiSimplex,0);
- if (ccd1.calcTimeOfImpact(col0->m_worldTransform,col0->m_interpolationWorldTransform,
- col1->m_worldTransform,col1->m_interpolationWorldTransform,result))
+ if (ccd1.calcTimeOfImpact(col0->getWorldTransform(),col0->getInterpolationWorldTransform(),
+ col1->getWorldTransform(),col1->getInterpolationWorldTransform(),result))
{
//store result.m_fraction in both bodies
- if (col0->m_hitFraction > result.m_fraction)
- col0->m_hitFraction = result.m_fraction;
+ if (col0->getHitFraction()> result.m_fraction)
+ col0->setHitFraction( result.m_fraction );
- if (col1->m_hitFraction > result.m_fraction)
- col1->m_hitFraction = result.m_fraction;
+ if (col1->getHitFraction() > result.m_fraction)
+ col1->setHitFraction( result.m_fraction);
if (resultFraction > result.m_fraction)
resultFraction = result.m_fraction;
@@ -245,26 +244,26 @@ float btConvexConvexAlgorithm::calculateTimeOfImpact(btCollisionObject* col0,btC
/// Sphere (for convex0) against Convex1
{
- btConvexShape* convex1 = static_cast<btConvexShape*>(col1->m_collisionShape);
+ btConvexShape* convex1 = static_cast<btConvexShape*>(col1->getCollisionShape());
- btSphereShape sphere0(col0->m_ccdSweptSphereRadius); //todo: allow non-zero sphere sizes, for better approximation
+ btSphereShape sphere0(col0->getCcdSweptSphereRadius()); //todo: allow non-zero sphere sizes, for better approximation
btConvexCast::CastResult result;
btVoronoiSimplexSolver voronoiSimplex;
//SubsimplexConvexCast ccd0(&sphere,min0,&voronoiSimplex);
///Simplification, one object is simplified as a sphere
btGjkConvexCast ccd1(&sphere0,convex1,&voronoiSimplex);
//ContinuousConvexCollision ccd(min0,min1,&voronoiSimplex,0);
- if (ccd1.calcTimeOfImpact(col0->m_worldTransform,col0->m_interpolationWorldTransform,
- col1->m_worldTransform,col1->m_interpolationWorldTransform,result))
+ if (ccd1.calcTimeOfImpact(col0->getWorldTransform(),col0->getInterpolationWorldTransform(),
+ col1->getWorldTransform(),col1->getInterpolationWorldTransform(),result))
{
//store result.m_fraction in both bodies
- if (col0->m_hitFraction > result.m_fraction)
- col0->m_hitFraction = result.m_fraction;
+ if (col0->getHitFraction() > result.m_fraction)
+ col0->setHitFraction( result.m_fraction);
- if (col1->m_hitFraction > result.m_fraction)
- col1->m_hitFraction = result.m_fraction;
+ if (col1->getHitFraction() > result.m_fraction)
+ col1->setHitFraction( result.m_fraction);
if (resultFraction > result.m_fraction)
resultFraction = result.m_fraction;
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp
index 1d3941101b2..cd22f3dd91e 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp
@@ -48,8 +48,8 @@ btManifoldResult::btManifoldResult(btCollisionObject* body0,btCollisionObject* b
m_body0(body0),
m_body1(body1)
{
- m_rootTransA = body0->m_worldTransform;
- m_rootTransB = body1->m_worldTransform;
+ m_rootTransA = body0->getWorldTransform();
+ m_rootTransB = body1->getWorldTransform();
}
@@ -81,8 +81,8 @@ void btManifoldResult::addContactPoint(const btVector3& normalOnBInWorld,const b
//User can override friction and/or restitution
if (gContactAddedCallback &&
//and if either of the two bodies requires custom material
- ((m_body0->m_collisionFlags & btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK) ||
- (m_body1->m_collisionFlags & btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK)))
+ ((m_body0->getCollisionFlags() & btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK) ||
+ (m_body1->getCollisionFlags() & btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK)))
{
//experimental feature info, for per-triangle material etc.
btCollisionObject* obj0 = isSwapped? m_body1 : m_body0;
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btManifoldResult.h b/extern/bullet2/src/BulletCollision/CollisionDispatch/btManifoldResult.h
index f9aae4e9c9a..3d70689e3eb 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btManifoldResult.h
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btManifoldResult.h
@@ -17,10 +17,12 @@ subject to the following restrictions:
#ifndef MANIFOLD_RESULT_H
#define MANIFOLD_RESULT_H
-#include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h"
-struct btCollisionObject;
+class btCollisionObject;
class btPersistentManifold;
class btManifoldPoint;
+
+#include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h"
+
#include "LinearMath/btTransform.h"
typedef bool (*ContactAddedCallback)(btManifoldPoint& cp, const btCollisionObject* colObj0,int partId0,int index0,const btCollisionObject* colObj1,int partId1,int index1);
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp
index d6ac86d19bd..be4f8686f30 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp
@@ -42,8 +42,8 @@ void btSimulationIslandManager::findUnions(btDispatcher* dispatcher)
((colObj1) && ((colObj1)->mergesSimulationIslands())))
{
- m_unionFind.unite((colObj0)->m_islandTag1,
- (colObj1)->m_islandTag1);
+ m_unionFind.unite((colObj0)->getIslandTag(),
+ (colObj1)->getIslandTag());
}
}
}
@@ -65,8 +65,8 @@ void btSimulationIslandManager::updateActivationState(btCollisionWorld* colWorld
{
btCollisionObject* collisionObject= (*i);
- collisionObject->m_islandTag1 = index;
- collisionObject->m_hitFraction = 1.f;
+ collisionObject->setIslandTag(index);
+ collisionObject->setHitFraction(1.f);
index++;
}
@@ -98,10 +98,10 @@ void btSimulationIslandManager::storeIslandActivationState(btCollisionWorld* col
if (collisionObject->mergesSimulationIslands())
{
- collisionObject->m_islandTag1 = m_unionFind.find(index);
+ collisionObject->setIslandTag( m_unionFind.find(index) );
} else
{
- collisionObject->m_islandTag1 = -1;
+ collisionObject->setIslandTag(-1);
}
index++;
}
@@ -113,7 +113,7 @@ inline int getIslandId(const btPersistentManifold* lhs)
int islandId;
const btCollisionObject* rcolObj0 = static_cast<const btCollisionObject*>(lhs->getBody0());
const btCollisionObject* rcolObj1 = static_cast<const btCollisionObject*>(lhs->getBody1());
- islandId= rcolObj0->m_islandTag1>=0?rcolObj0->m_islandTag1:rcolObj1->m_islandTag1;
+ islandId= rcolObj0->getIslandTag()>=0?rcolObj0->getIslandTag():rcolObj1->getIslandTag();
return islandId;
}
@@ -158,19 +158,19 @@ void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,
int i = getUnionFind().getElement(idx).m_sz;
btCollisionObject* colObj0 = collisionObjects[i];
- if ((colObj0->m_islandTag1 != islandId) && (colObj0->m_islandTag1 != -1))
+ if ((colObj0->getIslandTag() != islandId) && (colObj0->getIslandTag() != -1))
{
printf("error in island management\n");
}
- assert((colObj0->m_islandTag1 == islandId) || (colObj0->m_islandTag1 == -1));
- if (colObj0->m_islandTag1 == islandId)
+ assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
+ if (colObj0->getIslandTag() == islandId)
{
- if (colObj0->GetActivationState()== ACTIVE_TAG)
+ if (colObj0->getActivationState()== ACTIVE_TAG)
{
allSleeping = false;
}
- if (colObj0->GetActivationState()== DISABLE_DEACTIVATION)
+ if (colObj0->getActivationState()== DISABLE_DEACTIVATION)
{
allSleeping = false;
}
@@ -184,16 +184,16 @@ void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,
{
int i = getUnionFind().getElement(idx).m_sz;
btCollisionObject* colObj0 = collisionObjects[i];
- if ((colObj0->m_islandTag1 != islandId) && (colObj0->m_islandTag1 != -1))
+ if ((colObj0->getIslandTag() != islandId) && (colObj0->getIslandTag() != -1))
{
printf("error in island management\n");
}
- assert((colObj0->m_islandTag1 == islandId) || (colObj0->m_islandTag1 == -1));
+ assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
- if (colObj0->m_islandTag1 == islandId)
+ if (colObj0->getIslandTag() == islandId)
{
- colObj0->SetActivationState( ISLAND_SLEEPING );
+ colObj0->setActivationState( ISLAND_SLEEPING );
}
}
} else
@@ -205,18 +205,18 @@ void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,
int i = getUnionFind().getElement(idx).m_sz;
btCollisionObject* colObj0 = collisionObjects[i];
- if ((colObj0->m_islandTag1 != islandId) && (colObj0->m_islandTag1 != -1))
+ if ((colObj0->getIslandTag() != islandId) && (colObj0->getIslandTag() != -1))
{
printf("error in island management\n");
}
- assert((colObj0->m_islandTag1 == islandId) || (colObj0->m_islandTag1 == -1));
+ assert((colObj0->getIslandTag() == islandId) || (colObj0->getIslandTag() == -1));
- if (colObj0->m_islandTag1 == islandId)
+ if (colObj0->getIslandTag() == islandId)
{
- if ( colObj0->GetActivationState() == ISLAND_SLEEPING)
+ if ( colObj0->getActivationState() == ISLAND_SLEEPING)
{
- colObj0->SetActivationState( WANTS_DEACTIVATION);
+ colObj0->setActivationState( WANTS_DEACTIVATION);
}
}
}
@@ -236,17 +236,17 @@ void btSimulationIslandManager::buildAndProcessIslands(btDispatcher* dispatcher,
btCollisionObject* colObj1 = static_cast<btCollisionObject*>(manifold->getBody1());
//todo: check sleeping conditions!
- if (((colObj0) && colObj0->GetActivationState() != ISLAND_SLEEPING) ||
- ((colObj1) && colObj1->GetActivationState() != ISLAND_SLEEPING))
+ if (((colObj0) && colObj0->getActivationState() != ISLAND_SLEEPING) ||
+ ((colObj1) && colObj1->getActivationState() != ISLAND_SLEEPING))
{
//kinematic objects don't merge islands, but wake up all connected objects
- if (colObj0->isKinematicObject() && colObj0->GetActivationState() != ISLAND_SLEEPING)
+ if (colObj0->isKinematicObject() && colObj0->getActivationState() != ISLAND_SLEEPING)
{
- colObj1->SetActivationState(ACTIVE_TAG);
+ colObj1->setActivationState(ACTIVE_TAG);
}
- if (colObj1->isKinematicObject() && colObj1->GetActivationState() != ISLAND_SLEEPING)
+ if (colObj1->isKinematicObject() && colObj1->getActivationState() != ISLAND_SLEEPING)
{
- colObj0->SetActivationState(ACTIVE_TAG);
+ colObj0->setActivationState(ACTIVE_TAG);
}
//filtering for response
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp
index d32818444d7..1423c335407 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp
@@ -57,11 +57,11 @@ void btSphereBoxCollisionAlgorithm::processCollision (btCollisionObject* body0,b
btCollisionObject* boxObj = m_isSwapped? body0 : body1;
- btSphereShape* sphere0 = (btSphereShape*)sphereObj ->m_collisionShape;
+ btSphereShape* sphere0 = (btSphereShape*)sphereObj->getCollisionShape();
btVector3 normalOnSurfaceB;
btVector3 pOnBox,pOnSphere;
- btVector3 sphereCenter = sphereObj->m_worldTransform.getOrigin();
+ btVector3 sphereCenter = sphereObj->getWorldTransform().getOrigin();
btScalar radius = sphere0->getRadius();
float dist = getSphereDistance(boxObj,pOnBox,pOnSphere,sphereCenter,radius);
@@ -93,14 +93,14 @@ btScalar btSphereBoxCollisionAlgorithm::getSphereDistance(btCollisionObject* box
btScalar margins;
btVector3 bounds[2];
- btBoxShape* boxShape= (btBoxShape*)boxObj->m_collisionShape;
+ btBoxShape* boxShape= (btBoxShape*)boxObj->getCollisionShape();
bounds[0] = -boxShape->getHalfExtents();
bounds[1] = boxShape->getHalfExtents();
margins = boxShape->getMargin();//also add sphereShape margin?
- const btTransform& m44T = boxObj->m_worldTransform;
+ const btTransform& m44T = boxObj->getWorldTransform();
btVector3 boundsVec[2];
btScalar fPenetration;
@@ -209,7 +209,7 @@ btScalar btSphereBoxCollisionAlgorithm::getSpherePenetration( btCollisionObject*
n[4].setValue( 0.0f, 1.0f, 0.0f );
n[5].setValue( 0.0f, 0.0f, 1.0f );
- const btTransform& m44T = boxObj->m_worldTransform;
+ const btTransform& m44T = boxObj->getWorldTransform();
// convert point in local space
prel = m44T.invXform( sphereCenter);
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp
index bb04833ca5a..eb05bf974c5 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp
@@ -44,10 +44,10 @@ void btSphereSphereCollisionAlgorithm::processCollision (btCollisionObject* col0
if (!m_manifoldPtr)
return;
- btSphereShape* sphere0 = (btSphereShape*)col0->m_collisionShape;
- btSphereShape* sphere1 = (btSphereShape*)col1->m_collisionShape;
+ btSphereShape* sphere0 = (btSphereShape*)col0->getCollisionShape();
+ btSphereShape* sphere1 = (btSphereShape*)col1->getCollisionShape();
- btVector3 diff = col0->m_worldTransform.getOrigin()- col1->m_worldTransform.getOrigin();
+ btVector3 diff = col0->getWorldTransform().getOrigin()- col1->getWorldTransform().getOrigin();
float len = diff.length();
btScalar radius0 = sphere0->getRadius();
btScalar radius1 = sphere1->getRadius();
@@ -61,9 +61,9 @@ void btSphereSphereCollisionAlgorithm::processCollision (btCollisionObject* col0
btVector3 normalOnSurfaceB = diff / len;
///point on A (worldspace)
- btVector3 pos0 = col0->m_worldTransform.getOrigin() - radius0 * normalOnSurfaceB;
+ btVector3 pos0 = col0->getWorldTransform().getOrigin() - radius0 * normalOnSurfaceB;
///point on B (worldspace)
- btVector3 pos1 = col1->m_worldTransform.getOrigin() + radius1* normalOnSurfaceB;
+ btVector3 pos1 = col1->getWorldTransform().getOrigin() + radius1* normalOnSurfaceB;
/// report a contact. internally this will be kept persistent, and contact reduction is done
resultOut->setPersistentManifold(m_manifoldPtr);
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp
index ca589ef8629..6f74c488659 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp
@@ -48,8 +48,8 @@ void btSphereTriangleCollisionAlgorithm::processCollision (btCollisionObject* co
if (!m_manifoldPtr)
return;
- btSphereShape* sphere = (btSphereShape*)col0->m_collisionShape;
- btTriangleShape* triangle = (btTriangleShape*)col1->m_collisionShape;
+ btSphereShape* sphere = (btSphereShape*)col0->getCollisionShape();
+ btTriangleShape* triangle = (btTriangleShape*)col1->getCollisionShape();
/// report a contact. internally this will be kept persistent, and contact reduction is done
resultOut->setPersistentManifold(m_manifoldPtr);
@@ -57,8 +57,8 @@ void btSphereTriangleCollisionAlgorithm::processCollision (btCollisionObject* co
btDiscreteCollisionDetectorInterface::ClosestPointInput input;
input.m_maximumDistanceSquared = 1e30f;//todo: tighter bounds
- input.m_transformA = col0->m_worldTransform;
- input.m_transformB = col1->m_worldTransform;
+ input.m_transformA = col0->getWorldTransform();
+ input.m_transformB = col1->getWorldTransform();
detector.getClosestPoints(input,*resultOut,dispatchInfo.m_debugDraw);