summaryrefslogtreecommitdiff
path: root/thirdparty/bullet/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/bullet/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h')
-rw-r--r--thirdparty/bullet/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h246
1 files changed, 112 insertions, 134 deletions
diff --git a/thirdparty/bullet/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h b/thirdparty/bullet/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h
index 3e5675f729..a368c8a0c0 100644
--- a/thirdparty/bullet/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h
+++ b/thirdparty/bullet/BulletCollision/Gimpact/btGImpactCollisionAlgorithm.h
@@ -42,7 +42,6 @@ class btDispatcher;
#include "LinearMath/btIDebugDraw.h"
#include "BulletCollision/CollisionDispatch/btCollisionObjectWrapper.h"
-
//! Collision Algorithm for GImpact Shapes
/*!
For register this algorithm in Bullet, proceed as following:
@@ -54,36 +53,35 @@ btGImpactCollisionAlgorithm::registerAlgorithm(dispatcher);
class btGImpactCollisionAlgorithm : public btActivatingCollisionAlgorithm
{
protected:
- btCollisionAlgorithm * m_convex_algorithm;
- btPersistentManifold * m_manifoldPtr;
+ btCollisionAlgorithm* m_convex_algorithm;
+ btPersistentManifold* m_manifoldPtr;
btManifoldResult* m_resultOut;
- const btDispatcherInfo * m_dispatchInfo;
+ const btDispatcherInfo* m_dispatchInfo;
int m_triface0;
int m_part0;
int m_triface1;
int m_part1;
-
//! Creates a new contact point
- SIMD_FORCE_INLINE btPersistentManifold* newContactManifold(const btCollisionObject* body0,const btCollisionObject* body1)
+ SIMD_FORCE_INLINE btPersistentManifold* newContactManifold(const btCollisionObject* body0, const btCollisionObject* body1)
{
- m_manifoldPtr = m_dispatcher->getNewManifold(body0,body1);
+ m_manifoldPtr = m_dispatcher->getNewManifold(body0, body1);
return m_manifoldPtr;
}
SIMD_FORCE_INLINE void destroyConvexAlgorithm()
{
- if(m_convex_algorithm)
+ if (m_convex_algorithm)
{
m_convex_algorithm->~btCollisionAlgorithm();
- m_dispatcher->freeCollisionAlgorithm( m_convex_algorithm);
+ m_dispatcher->freeCollisionAlgorithm(m_convex_algorithm);
m_convex_algorithm = NULL;
}
}
SIMD_FORCE_INLINE void destroyContactManifolds()
{
- if(m_manifoldPtr == NULL) return;
+ if (m_manifoldPtr == NULL) return;
m_dispatcher->releaseManifold(m_manifoldPtr);
m_manifoldPtr = NULL;
}
@@ -104,207 +102,187 @@ protected:
return m_manifoldPtr;
}
-
// Call before process collision
- SIMD_FORCE_INLINE void checkManifold(const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap)
+ SIMD_FORCE_INLINE void checkManifold(const btCollisionObjectWrapper* body0Wrap, const btCollisionObjectWrapper* body1Wrap)
{
- if(getLastManifold() == 0)
+ if (getLastManifold() == 0)
{
- newContactManifold(body0Wrap->getCollisionObject(),body1Wrap->getCollisionObject());
+ newContactManifold(body0Wrap->getCollisionObject(), body1Wrap->getCollisionObject());
}
m_resultOut->setPersistentManifold(getLastManifold());
}
// Call before process collision
- SIMD_FORCE_INLINE btCollisionAlgorithm * newAlgorithm(const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap)
+ SIMD_FORCE_INLINE btCollisionAlgorithm* newAlgorithm(const btCollisionObjectWrapper* body0Wrap, const btCollisionObjectWrapper* body1Wrap)
{
- checkManifold(body0Wrap,body1Wrap);
+ checkManifold(body0Wrap, body1Wrap);
- btCollisionAlgorithm * convex_algorithm = m_dispatcher->findAlgorithm(
- body0Wrap,body1Wrap,getLastManifold(), BT_CONTACT_POINT_ALGORITHMS);
- return convex_algorithm ;
+ btCollisionAlgorithm* convex_algorithm = m_dispatcher->findAlgorithm(
+ body0Wrap, body1Wrap, getLastManifold(), BT_CONTACT_POINT_ALGORITHMS);
+ return convex_algorithm;
}
// Call before process collision
- SIMD_FORCE_INLINE void checkConvexAlgorithm(const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap)
+ SIMD_FORCE_INLINE void checkConvexAlgorithm(const btCollisionObjectWrapper* body0Wrap, const btCollisionObjectWrapper* body1Wrap)
{
- if(m_convex_algorithm) return;
- m_convex_algorithm = newAlgorithm(body0Wrap,body1Wrap);
+ if (m_convex_algorithm) return;
+ m_convex_algorithm = newAlgorithm(body0Wrap, body1Wrap);
}
+ void addContactPoint(const btCollisionObjectWrapper* body0Wrap,
+ const btCollisionObjectWrapper* body1Wrap,
+ const btVector3& point,
+ const btVector3& normal,
+ btScalar distance);
-
-
- void addContactPoint(const btCollisionObjectWrapper * body0Wrap,
- const btCollisionObjectWrapper * body1Wrap,
- const btVector3 & point,
- const btVector3 & normal,
- btScalar distance);
-
-//! Collision routines
-//!@{
+ //! Collision routines
+ //!@{
void collide_gjk_triangles(const btCollisionObjectWrapper* body0Wrap,
- const btCollisionObjectWrapper* body1Wrap,
- const btGImpactMeshShapePart * shape0,
- const btGImpactMeshShapePart * shape1,
- const int * pairs, int pair_count);
+ const btCollisionObjectWrapper* body1Wrap,
+ const btGImpactMeshShapePart* shape0,
+ const btGImpactMeshShapePart* shape1,
+ const int* pairs, int pair_count);
void collide_sat_triangles(const btCollisionObjectWrapper* body0Wrap,
- const btCollisionObjectWrapper* body1Wrap,
- const btGImpactMeshShapePart * shape0,
- const btGImpactMeshShapePart * shape1,
- const int * pairs, int pair_count);
-
-
-
+ const btCollisionObjectWrapper* body1Wrap,
+ const btGImpactMeshShapePart* shape0,
+ const btGImpactMeshShapePart* shape1,
+ const int* pairs, int pair_count);
void shape_vs_shape_collision(
- const btCollisionObjectWrapper* body0,
- const btCollisionObjectWrapper* body1,
- const btCollisionShape * shape0,
- const btCollisionShape * shape1);
+ const btCollisionObjectWrapper* body0,
+ const btCollisionObjectWrapper* body1,
+ const btCollisionShape* shape0,
+ const btCollisionShape* shape1);
void convex_vs_convex_collision(const btCollisionObjectWrapper* body0Wrap,
- const btCollisionObjectWrapper* body1Wrap,
- const btCollisionShape* shape0,
- const btCollisionShape* shape1);
-
-
+ const btCollisionObjectWrapper* body1Wrap,
+ const btCollisionShape* shape0,
+ const btCollisionShape* shape1);
void gimpact_vs_gimpact_find_pairs(
- const btTransform & trans0,
- const btTransform & trans1,
- const btGImpactShapeInterface * shape0,
- const btGImpactShapeInterface * shape1,btPairSet & pairset);
+ const btTransform& trans0,
+ const btTransform& trans1,
+ const btGImpactShapeInterface* shape0,
+ const btGImpactShapeInterface* shape1, btPairSet& pairset);
void gimpact_vs_shape_find_pairs(
- const btTransform & trans0,
- const btTransform & trans1,
- const btGImpactShapeInterface * shape0,
- const btCollisionShape * shape1,
- btAlignedObjectArray<int> & collided_primitives);
-
+ const btTransform& trans0,
+ const btTransform& trans1,
+ const btGImpactShapeInterface* shape0,
+ const btCollisionShape* shape1,
+ btAlignedObjectArray<int>& collided_primitives);
void gimpacttrimeshpart_vs_plane_collision(
- const btCollisionObjectWrapper * body0Wrap,
- const btCollisionObjectWrapper * body1Wrap,
- const btGImpactMeshShapePart * shape0,
- const btStaticPlaneShape * shape1,bool swapped);
-
+ const btCollisionObjectWrapper* body0Wrap,
+ const btCollisionObjectWrapper* body1Wrap,
+ const btGImpactMeshShapePart* shape0,
+ const btStaticPlaneShape* shape1, bool swapped);
public:
-
- btGImpactCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci,const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap);
+ btGImpactCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo& ci, const btCollisionObjectWrapper* body0Wrap, const btCollisionObjectWrapper* body1Wrap);
virtual ~btGImpactCollisionAlgorithm();
- virtual void processCollision (const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
+ virtual void processCollision(const btCollisionObjectWrapper* body0Wrap, const btCollisionObjectWrapper* body1Wrap, const btDispatcherInfo& dispatchInfo, btManifoldResult* resultOut);
- btScalar calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
+ btScalar calculateTimeOfImpact(btCollisionObject* body0, btCollisionObject* body1, const btDispatcherInfo& dispatchInfo, btManifoldResult* resultOut);
- virtual void getAllContactManifolds(btManifoldArray& manifoldArray)
+ virtual void getAllContactManifolds(btManifoldArray& manifoldArray)
{
if (m_manifoldPtr)
manifoldArray.push_back(m_manifoldPtr);
}
- btManifoldResult* internalGetResultOut()
+ btManifoldResult* internalGetResultOut()
{
return m_resultOut;
}
- struct CreateFunc :public btCollisionAlgorithmCreateFunc
+ struct CreateFunc : public btCollisionAlgorithmCreateFunc
{
- virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap)
+ virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, const btCollisionObjectWrapper* body0Wrap, const btCollisionObjectWrapper* body1Wrap)
{
void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btGImpactCollisionAlgorithm));
- return new(mem) btGImpactCollisionAlgorithm(ci,body0Wrap,body1Wrap);
+ return new (mem) btGImpactCollisionAlgorithm(ci, body0Wrap, body1Wrap);
}
};
//! Use this function for register the algorithm externally
- static void registerAlgorithm(btCollisionDispatcher * dispatcher);
+ static void registerAlgorithm(btCollisionDispatcher* dispatcher);
#ifdef TRI_COLLISION_PROFILING
//! Gets the average time in miliseconds of tree collisions
static float getAverageTreeCollisionTime();
//! Gets the average time in miliseconds of triangle collisions
static float getAverageTriangleCollisionTime();
-#endif //TRI_COLLISION_PROFILING
+#endif //TRI_COLLISION_PROFILING
//! Collides two gimpact shapes
/*!
\pre shape0 and shape1 couldn't be btGImpactMeshShape objects
*/
-
void gimpact_vs_gimpact(const btCollisionObjectWrapper* body0Wrap,
- const btCollisionObjectWrapper * body1Wrap,
- const btGImpactShapeInterface * shape0,
- const btGImpactShapeInterface * shape1);
+ const btCollisionObjectWrapper* body1Wrap,
+ const btGImpactShapeInterface* shape0,
+ const btGImpactShapeInterface* shape1);
void gimpact_vs_shape(const btCollisionObjectWrapper* body0Wrap,
- const btCollisionObjectWrapper* body1Wrap,
- const btGImpactShapeInterface * shape0,
- const btCollisionShape * shape1,bool swapped);
+ const btCollisionObjectWrapper* body1Wrap,
+ const btGImpactShapeInterface* shape0,
+ const btCollisionShape* shape1, bool swapped);
- void gimpact_vs_compoundshape(const btCollisionObjectWrapper * body0Wrap,
- const btCollisionObjectWrapper * body1Wrap,
- const btGImpactShapeInterface * shape0,
- const btCompoundShape * shape1,bool swapped);
+ void gimpact_vs_compoundshape(const btCollisionObjectWrapper* body0Wrap,
+ const btCollisionObjectWrapper* body1Wrap,
+ const btGImpactShapeInterface* shape0,
+ const btCompoundShape* shape1, bool swapped);
void gimpact_vs_concave(
- const btCollisionObjectWrapper * body0Wrap,
- const btCollisionObjectWrapper * body1Wrap,
- const btGImpactShapeInterface * shape0,
- const btConcaveShape * shape1,bool swapped);
-
-
-
-
- /// Accessor/Mutator pairs for Part and triangleID
- void setFace0(int value)
- {
- m_triface0 = value;
- }
- int getFace0()
- {
- return m_triface0;
- }
- void setFace1(int value)
- {
- m_triface1 = value;
- }
- int getFace1()
- {
- return m_triface1;
- }
- void setPart0(int value)
- {
- m_part0 = value;
- }
- int getPart0()
- {
- return m_part0;
- }
- void setPart1(int value)
- {
- m_part1 = value;
- }
- int getPart1()
- {
- return m_part1;
- }
+ const btCollisionObjectWrapper* body0Wrap,
+ const btCollisionObjectWrapper* body1Wrap,
+ const btGImpactShapeInterface* shape0,
+ const btConcaveShape* shape1, bool swapped);
+ /// Accessor/Mutator pairs for Part and triangleID
+ void setFace0(int value)
+ {
+ m_triface0 = value;
+ }
+ int getFace0()
+ {
+ return m_triface0;
+ }
+ void setFace1(int value)
+ {
+ m_triface1 = value;
+ }
+ int getFace1()
+ {
+ return m_triface1;
+ }
+ void setPart0(int value)
+ {
+ m_part0 = value;
+ }
+ int getPart0()
+ {
+ return m_part0;
+ }
+ void setPart1(int value)
+ {
+ m_part1 = value;
+ }
+ int getPart1()
+ {
+ return m_part1;
+ }
};
-
//algorithm details
//#define BULLET_TRIANGLE_COLLISION 1
#define GIMPACT_VS_PLANE_COLLISION 1
-
-
-#endif //BT_GIMPACT_BVH_CONCAVE_COLLISION_ALGORITHM_H
+#endif //BT_GIMPACT_BVH_CONCAVE_COLLISION_ALGORITHM_H