66 #ifdef TRI_COLLISION_PROFILING 70 float g_accum_triangle_collision_time = 0;
71 int g_count_triangle_collision = 0;
73 void bt_begin_gim02_tri_time()
75 g_triangle_clock.
reset();
78 void bt_end_gim02_tri_time()
81 g_count_triangle_collision++;
83 #endif //TRI_COLLISION_PROFILING 114 m_parent->m_gim_shape->getBulletTriangle(index,m_parent->m_trishape);
115 return &m_parent->m_trishape;
126 m_parent->m_gim_shape->getBulletTetrahedron(index,m_parent->m_tetrashape);
127 return &m_parent->m_tetrashape;
138 m_gim_shape = gim_shape;
142 m_current_retriever = &m_tri_retriever;
146 m_current_retriever = &m_tetra_retriever;
150 m_current_retriever = &m_child_retriever;
153 m_current_retriever->
m_parent =
this;
169 #ifdef TRI_COLLISION_PROFILING 172 float btGImpactCollisionAlgorithm::getAverageTreeCollisionTime()
174 return btGImpactBoxSet::getAverageTreeCollisionTime();
179 float btGImpactCollisionAlgorithm::getAverageTriangleCollisionTime()
181 if(g_count_triangle_collision == 0)
return 0;
183 float avgtime = g_accum_triangle_collision_time;
184 avgtime /= (float)g_count_triangle_collision;
186 g_accum_triangle_collision_time = 0;
187 g_count_triangle_collision = 0;
192 #endif //TRI_COLLISION_PROFILING 353 const int * pairs,
int pair_count)
361 const int * pair_pointer = pairs;
392 const int * pairs,
int pair_count)
404 const int * pair_pointer = pairs;
417 #ifdef TRI_COLLISION_PROFILING 418 bt_begin_gim02_tri_time();
449 #ifdef TRI_COLLISION_PROFILING 450 bt_end_gim02_tri_time();
504 if(pairset.
size()== 0)
return;
512 #ifdef BULLET_TRIANGLE_COLLISION 532 int i = pairset.
size();
544 if(child_has_transform0)
549 if(child_has_transform1)
589 #ifdef GIMPACT_VS_PLANE_COLLISION 625 if(collided_results.
size() == 0)
return;
636 int i = collided_results.
size();
640 int child_index = collided_results[i];
650 if(child_has_transform0)
713 shape0,colshape1,swapped);
757 vertex = orgtrans0(vertex);
759 btScalar distance = vertex.
dot(plane) - plane[3] - margin;
825 body0Wrap,&ob1Wrap,gimpactshape0,&tri1,swapped);
862 shape0->
getAabb(gimpactInConcaveSpace,minAABB,maxAABB);
bool overlap_test_conservative(const btTriangleShapeEx &other)
class btTriangleShapeEx: public btTriangleShape
virtual bool childrenHasTransform() const =0
if true, then its children must get transforms.
virtual void processTriangle(btVector3 *triangle, int partId, int triangleIndex)
bool overlap_test_conservative(const btPrimitiveTriangle &other)
Test if triangles could collide.
void push_back(const T &_Val)
void registerCollisionCreateFunc(int proxyType0, int proxyType1, btCollisionAlgorithmCreateFunc *createFunc)
registerCollisionCreateFunc allows registration of custom/alternative collision create functions ...
virtual bool needsRetrieveTetrahedrons() const =0
Determines if this shape has tetrahedrons.
Helper class for colliding Bullet Triangle Shapes.
virtual btCollisionShape * getChildShape(int index)
virtual void unlockChildShapes() const
const btGImpactShapeInterface * m_gim_shape
virtual void processCollision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)=0
virtual bool needsRetrieveTriangles() const =0
Determines if this shape has triangles.
virtual ~TriangleShapeRetriever()
void collide_gjk_triangles(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactMeshShapePart *shape0, const btGImpactMeshShapePart *shape1, const int *pairs, int pair_count)
Collision routines.
void getVertex(int vertex_index, btVector3 &vertex) const
btPersistentManifold * m_manifoldPtr
This class is not enabled yet (work-in-progress) to more aggressively activate objects.
virtual ~btGImpactCollisionAlgorithm()
const btCollisionObjectWrapper * body1Wrap
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
void checkManifold(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
The btClock is a portable basic clock that measures accurate time in seconds, use for profiling...
btCollisionDispatcher supports algorithms that handle ConvexConvex and ConvexConcave collision pairs...
ChildShapeRetriever m_child_retriever
void reset()
Resets the initial reference time.
btManifoldResult is a helper class to manage contact results.
virtual ~btCollisionAlgorithm()
const btCollisionObjectWrapper * getBody1Wrap() const
Retrieving shapes shapes.
const btVector3 & getRow(int i) const
Get a row of the matrix as a vector.
This class manages a mesh supplied by the btStridingMeshInterface interface.
Used for GIMPACT Trimesh integration.
virtual void processAllTriangles(btTriangleCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const =0
void gimpact_vs_shape_find_pairs(const btTransform &trans0, const btTransform &trans1, const btGImpactShapeInterface *shape0, const btCollisionShape *shape1, btAlignedObjectArray< int > &collided_primitives)
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 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...
btScalar dot(const btVector3 &v) const
Return the dot product.
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const
btDispatcher * m_dispatcher
void gimpact_vs_concave(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactShapeInterface *shape0, const btConcaveShape *shape1, bool swapped)
void gimpact_vs_gimpact(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactShapeInterface *shape0, const btGImpactShapeInterface *shape1)
Collides two gimpact shapes.
virtual btCollisionShape * getChildShape(int index)
void gimpact_vs_compoundshape(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactShapeInterface *shape0, const btCompoundShape *shape1, bool swapped)
void push_pair(int index1, int index2)
virtual void setShapeIdentifiersA(int partId0, int index0)
setShapeIdentifiersA/B provides experimental support for per-triangle material / custom material comb...
bool hasBoxSet() const
Determines if this class has a hierarchy structure for sorting its primitives.
virtual void addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorld, btScalar depth)
btGImpactMeshShapePart * getMeshPart(int index)
virtual void setMargin(btScalar margin)
Base class for gimpact shapes.
This class manages a sub part of a mesh supplied by the btStridingMeshInterface interface.
const btGImpactBoxSet * getBoxSet() const
gets boxset
int size() const
return the number of elements in the array
btTetrahedronShapeEx m_tetrashape
virtual ~ChildShapeRetriever()
The btTriangleCallback provides a callback for each overlapping triangle when calling processAllTrian...
const btCollisionObjectWrapper * getBody0Wrap() const
btTransform & getChildTransform(int index)
GIM_ShapeRetriever * m_parent
btGImpactCollisionAlgorithm(const btCollisionAlgorithmConstructionInfo &ci, const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
virtual void lockChildShapes() const
call when reading child shapes
void convex_vs_convex_collision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btCollisionShape *shape0, const btCollisionShape *shape1)
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const =0
Subshape member functions.
const btTransform & getWorldTransform() const
btCollisionObject can be used to manage collision detection objects.
unsigned long long int getTimeMicroseconds()
Returns the time in us since the last call to reset or since the Clock was created.
virtual void unlockChildShapes() const
virtual void freeCollisionAlgorithm(void *ptr)=0
Helper class for tetrahedrons.
virtual btCollisionShape * getChildShape(int index)=0
Gets the children.
virtual void setShapeIdentifiersB(int partId1, int index1)
btScalar getMargin() const
void gimpacttrimeshpart_vs_plane_collision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactMeshShapePart *shape0, const btStaticPlaneShape *shape1, bool swapped)
btGImpactCollisionAlgorithm * algorithm
const btCollisionShape * getCollisionShape() const
void increment_margin(btScalar margin)
btVector3 can be used to represent 3D points and vectors.
const btGImpactShapeInterface * gimpactshape0
btTriangleShapeEx m_trishape
static void registerAlgorithm(btCollisionDispatcher *dispatcher)
Use this function for register the algorithm externally.
bool find_triangle_collision_clip_method(btPrimitiveTriangle &other, GIM_TRIANGLE_CONTACT &contacts)
Find collision using the clipping method.
virtual btTransform getChildTransform(int index) const =0
Gets the children transform.
void gimpact_vs_gimpact_find_pairs(const btTransform &trans0, const btTransform &trans1, const btGImpactShapeInterface *shape0, const btGImpactShapeInterface *shape1, btPairSet &pairset)
The btConcaveShape class provides an interface for non-moving (static) concave shapes.
virtual int getNumChildShapes() const =0
Gets the number of children.
virtual void getChildAabb(int child_index, const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
Retrieves the bound from a child.
btScalar calculateTimeOfImpact(btCollisionObject *body0, btCollisionObject *body1, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
btCollisionAlgorithm * m_convex_algorithm
void setBody1Wrap(const btCollisionObjectWrapper *obj1Wrap)
const btCollisionShape * getChildShape(int index)
Class for accessing the plane equation.
TriangleShapeRetriever m_tri_retriever
void setFace0(int value)
Accessor/Mutator pairs for Part and triangleID.
virtual void lockChildShapes() const
call when reading child shapes
GIM_ShapeRetriever(const btGImpactShapeInterface *gim_shape)
btCollisionAlgorithm * newAlgorithm(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
bool boxQuery(const btAABB &box, btAlignedObjectArray< int > &collided_results) const
returns the indices of the primitives in the m_primitive_manager
const btDispatcherInfo * m_dispatchInfo
virtual btScalar getMargin() const
void get_plane_equation(btVector4 &equation)
The btCompoundShape allows to store multiple other btCollisionShapes This allows for moving concave c...
void setBody0Wrap(const btCollisionObjectWrapper *obj0Wrap)
TetraShapeRetriever m_tetra_retriever
void shape_vs_shape_collision(const btCollisionObjectWrapper *body0, const btCollisionObjectWrapper *body1, const btCollisionShape *shape0, const btCollisionShape *shape1)
static void find_collision(const btGImpactQuantizedBvh *boxset1, const btTransform &trans1, const btGImpactQuantizedBvh *boxset2, const btTransform &trans2, btPairSet &collision_pairs)
The btStaticPlaneShape simulates an infinite non-moving (static) collision plane. ...
void getPrimitiveTriangle(int index, btPrimitiveTriangle &triangle) const
if this trimesh
void collide_sat_triangles(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactMeshShapePart *shape0, const btGImpactMeshShapePart *shape1, const int *pairs, int pair_count)
btCollisionShape * getChildShape(int index)
btManifoldResult * internalGetResultOut()
btManifoldResult * m_resultOut
btCollisionAlgorithm is an collision interface that is compatible with the Broadphase and btDispatche...
int getMeshPartCount() const
Collision Algorithm for GImpact Shapes.
void addContactPoint(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btVector3 &point, const btVector3 &normal, btScalar distance)
ChildShapeRetriever * m_current_retriever
const btCollisionObjectWrapper * body0Wrap
virtual void processCollision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
btPlaneShape(const btVector3 &v, float f)
eBT_PLANE_INTERSECTION_TYPE plane_classify(const btVector4 &plane) const
void get_plane_equation_transformed(const btTransform &trans, btVector4 &equation) const
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
virtual const btCollisionShape * getChildShape(int index)
void applyTransform(const btTransform &t)
bool has_collision(const btAABB &other) const
void gimpact_vs_shape(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactShapeInterface *shape0, const btCollisionShape *shape1, bool swapped)
void checkConvexAlgorithm(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
const btCollisionObject * getCollisionObject() const
int getVertexCount() const
int getNumChildShapes() const