54 equation[0] = normal[0];
55 equation[1] = normal[1];
56 equation[2] = normal[2];
62#ifdef TRI_COLLISION_PROFILING
66float g_accum_triangle_collision_time = 0;
67int g_count_triangle_collision = 0;
69void bt_begin_gim02_tri_time()
71 g_triangle_clock.
reset();
74void bt_end_gim02_tri_time()
77 g_count_triangle_collision++;
159#ifdef TRI_COLLISION_PROFILING
162float btGImpactCollisionAlgorithm::getAverageTreeCollisionTime()
164 return btGImpactBoxSet::getAverageTreeCollisionTime();
168float btGImpactCollisionAlgorithm::getAverageTriangleCollisionTime()
170 if (g_count_triangle_collision == 0)
return 0;
172 float avgtime = g_accum_triangle_collision_time;
173 avgtime /= (float)g_count_triangle_collision;
175 g_accum_triangle_collision_time = 0;
176 g_count_triangle_collision = 0;
317 const int* pairs,
int pair_count)
325 const int* pair_pointer = pairs;
351 const int* pairs,
int pair_count)
363 const int* pair_pointer = pairs;
374#ifdef TRI_COLLISION_PROFILING
375 bt_begin_gim02_tri_time();
401#ifdef TRI_COLLISION_PROFILING
402 bt_end_gim02_tri_time();
449 if (pairset.
size() == 0)
return;
457#ifdef BULLET_TRIANGLE_COLLISION
477 int i = pairset.
size();
489 if (child_has_transform0)
494 if (child_has_transform1)
532#ifdef GIMPACT_VS_PLANE_COLLISION
565 if (collided_results.
size() == 0)
return;
573 int i = collided_results.
size();
577 int child_index = collided_results[i];
587 if (child_has_transform0)
657 shape0, colshape1, swapped);
700 vertex = orgtrans0(vertex);
702 btScalar distance = vertex.
dot(plane) - plane[3] - margin;
800 shape0->
getAabb(gimpactInConcaveSpace, minAABB, maxAABB);
@ GIMPACT_SHAPE_PROXYTYPE
Used for GIMPACT Trimesh integration.
@ MAX_BROADPHASE_COLLISION_TYPES
@ CONST_GIMPACT_TRIMESH_SHAPE
@ CONST_GIMPACT_TRIMESH_SHAPE_PART
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
virtual const btCollisionShape * getChildShape(int index)
GIM_ShapeRetriever * m_parent
virtual ~ChildShapeRetriever()
virtual btCollisionShape * getChildShape(int index)
virtual ~TriangleShapeRetriever()
virtual btCollisionShape * getChildShape(int index)
Retrieving shapes shapes.
TetraShapeRetriever m_tetra_retriever
GIM_ShapeRetriever(const btGImpactShapeInterface *gim_shape)
ChildShapeRetriever * m_current_retriever
const btCollisionShape * getChildShape(int index)
btTetrahedronShapeEx m_tetrashape
btTriangleShapeEx m_trishape
TriangleShapeRetriever m_tri_retriever
const btGImpactShapeInterface * m_gim_shape
ChildShapeRetriever m_child_retriever
eBT_PLANE_INTERSECTION_TYPE plane_classify(const btVector4 &plane) const
void increment_margin(btScalar margin)
bool has_collision(const btAABB &other) const
This class is not enabled yet (work-in-progress) to more aggressively activate objects.
int size() const
return the number of elements in the array
void push_back(const T &_Val)
The btClock is a portable basic clock that measures accurate time in seconds, use for profiling.
void reset()
Resets the initial reference time.
unsigned long long int getTimeMicroseconds()
Returns the time in us since the last call to reset or since the Clock was created.
btCollisionAlgorithm is an collision interface that is compatible with the Broadphase and btDispatche...
btDispatcher * m_dispatcher
virtual void processCollision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)=0
virtual ~btCollisionAlgorithm()
btCollisionDispatcher supports algorithms that handle ConvexConvex and ConvexConcave collision pairs.
void registerCollisionCreateFunc(int proxyType0, int proxyType1, btCollisionAlgorithmCreateFunc *createFunc)
registerCollisionCreateFunc allows registration of custom/alternative collision create functions
btCollisionObject can be used to manage collision detection objects.
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
virtual void getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const =0
getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t.
The btCompoundShape allows to store multiple other btCollisionShapes This allows for moving concave c...
btCollisionShape * getChildShape(int index)
btTransform & getChildTransform(int index)
int getNumChildShapes() const
The btConcaveShape class provides an interface for non-moving (static) concave shapes.
virtual btScalar getMargin() const
virtual void processAllTriangles(btTriangleCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const =0
virtual void setMargin(btScalar margin)
virtual void freeCollisionAlgorithm(void *ptr)=0
Collision Algorithm for GImpact Shapes.
btPersistentManifold * getLastManifold()
void gimpact_vs_concave(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactShapeInterface *shape0, const btConcaveShape *shape1, bool swapped)
void gimpact_vs_shape_find_pairs(const btTransform &trans0, const btTransform &trans1, const btGImpactShapeInterface *shape0, const btCollisionShape *shape1, btAlignedObjectArray< int > &collided_primitives)
void setFace0(int value)
Accessor/Mutator pairs for Part and triangleID.
btCollisionAlgorithm * newAlgorithm(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
void collide_gjk_triangles(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactMeshShapePart *shape0, const btGImpactMeshShapePart *shape1, const int *pairs, int pair_count)
Collision routines.
btCollisionAlgorithm * m_convex_algorithm
const btDispatcherInfo * m_dispatchInfo
void checkConvexAlgorithm(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
void gimpact_vs_gimpact(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactShapeInterface *shape0, const btGImpactShapeInterface *shape1)
Collides two gimpact shapes.
void gimpact_vs_compoundshape(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactShapeInterface *shape0, const btCompoundShape *shape1, bool swapped)
btManifoldResult * internalGetResultOut()
btScalar calculateTimeOfImpact(btCollisionObject *body0, btCollisionObject *body1, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
void gimpact_vs_gimpact_find_pairs(const btTransform &trans0, const btTransform &trans1, const btGImpactShapeInterface *shape0, const btGImpactShapeInterface *shape1, btPairSet &pairset)
btGImpactCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
void gimpacttrimeshpart_vs_plane_collision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactMeshShapePart *shape0, const btStaticPlaneShape *shape1, bool swapped)
void gimpact_vs_shape(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactShapeInterface *shape0, const btCollisionShape *shape1, bool swapped)
btPersistentManifold * m_manifoldPtr
virtual ~btGImpactCollisionAlgorithm()
btManifoldResult * m_resultOut
void convex_vs_convex_collision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btCollisionShape *shape0, const btCollisionShape *shape1)
void checkManifold(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
static void registerAlgorithm(btCollisionDispatcher *dispatcher)
Use this function for register the algorithm externally.
void collide_sat_triangles(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactMeshShapePart *shape0, const btGImpactMeshShapePart *shape1, const int *pairs, int pair_count)
virtual void processCollision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
void shape_vs_shape_collision(const btCollisionObjectWrapper *body0, const btCollisionObjectWrapper *body1, const btCollisionShape *shape0, const btCollisionShape *shape1)
void addContactPoint(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btVector3 &point, const btVector3 &normal, btScalar distance)
This class manages a sub part of a mesh supplied by the btStridingMeshInterface interface.
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const
btScalar getMargin() const
void getVertex(int vertex_index, btVector3 &vertex) const
int getVertexCount() const
virtual void lockChildShapes() const
call when reading child shapes
virtual void unlockChildShapes() const
This class manages a mesh supplied by the btStridingMeshInterface interface.
int getMeshPartCount() const
btGImpactMeshShapePart * getMeshPart(int index)
bool boxQuery(const btAABB &box, btAlignedObjectArray< int > &collided_results) const
returns the indices of the primitives in the m_primitive_manager
static void find_collision(const btGImpactQuantizedBvh *boxset1, const btTransform &trans1, const btGImpactQuantizedBvh *boxset2, const btTransform &trans2, btPairSet &collision_pairs)
Base class for gimpact shapes.
void getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
If the Bounding box is not updated, then this class attemps to calculate it.
virtual btCollisionShape * getChildShape(int index)=0
Gets the children.
const btGImpactBoxSet * getBoxSet() const
gets boxset
virtual void getChildAabb(int child_index, const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
Retrieves the bound from a child.
void getPrimitiveTriangle(int index, btPrimitiveTriangle &triangle) const
if this trimesh
bool hasBoxSet() const
Determines if this class has a hierarchy structure for sorting its primitives.
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const =0
Subshape member functions.
virtual void lockChildShapes() const
call when reading child shapes
virtual bool needsRetrieveTriangles() const =0
Determines if this shape has triangles.
virtual void getBulletTetrahedron(int prim_index, btTetrahedronShapeEx &tetrahedron) const =0
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const =0
virtual bool childrenHasTransform() const =0
if true, then its children must get transforms.
virtual int getNumChildShapes() const =0
Gets the number of children.
virtual btTransform getChildTransform(int index) const =0
Gets the children transform.
virtual bool needsRetrieveTetrahedrons() const =0
Determines if this shape has tetrahedrons.
virtual void unlockChildShapes() const
const btCollisionObjectWrapper * body1Wrap
virtual void processTriangle(btVector3 *triangle, int partId, int triangleIndex)
btGImpactCollisionAlgorithm * algorithm
const btGImpactShapeInterface * gimpactshape0
const btCollisionObjectWrapper * body0Wrap
btManifoldResult is a helper class to manage contact results.
virtual void setShapeIdentifiersA(int partId0, int index0)
setShapeIdentifiersA/B provides experimental support for per-triangle material / custom material comb...
void setBody0Wrap(const btCollisionObjectWrapper *obj0Wrap)
const btCollisionObjectWrapper * getBody1Wrap() const
void setBody1Wrap(const btCollisionObjectWrapper *obj1Wrap)
virtual void setShapeIdentifiersB(int partId1, int index1)
void refreshContactPoints()
const btCollisionObjectWrapper * getBody0Wrap() const
virtual void addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorld, btScalar depth)
void push_pair(int index1, int index2)
Class for accessing the plane equation.
void get_plane_equation_transformed(const btTransform &trans, btVector4 &equation) const
void get_plane_equation(btVector4 &equation)
btPlaneShape(const btVector3 &v, float f)
bool find_triangle_collision_clip_method(btPrimitiveTriangle &other, GIM_TRIANGLE_CONTACT &contacts)
Find collision using the clipping method.
bool overlap_test_conservative(const btPrimitiveTriangle &other)
Test if triangles could collide.
void applyTransform(const btTransform &t)
The btStaticPlaneShape simulates an infinite non-moving (static) collision plane.
Helper class for tetrahedrons.
The btTriangleCallback provides a callback for each overlapping triangle when calling processAllTrian...
Helper class for colliding Bullet Triangle Shapes.
bool overlap_test_conservative(const btTriangleShapeEx &other)
class btTriangleShapeEx: public btTriangleShape
btVector3 can be used to represent 3D points and vectors.
btScalar dot(const btVector3 &v) const
Return the dot product.
const btCollisionShape * getCollisionShape() const
const btCollisionObject * getCollisionObject() const
const btTransform & getWorldTransform() const