62 #ifdef TRI_COLLISION_PROFILING
66 float g_accum_triangle_collision_time = 0;
67 int g_count_triangle_collision = 0;
69 void bt_begin_gim02_tri_time()
71 g_triangle_clock.
reset();
74 void bt_end_gim02_tri_time()
77 g_count_triangle_collision++;
159 #ifdef TRI_COLLISION_PROFILING
162 float btGImpactCollisionAlgorithm::getAverageTreeCollisionTime()
164 return btGImpactBoxSet::getAverageTreeCollisionTime();
168 float 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;
260 shape0->
getChildAabb(i, trans0, boxshape0.m_min, boxshape0.m_max);
265 shape1->
getChildAabb(i, trans1, boxshape1.m_min, boxshape1.m_max);
267 if (boxshape1.has_collision(boxshape0))
290 shape1->getAabb(trans1to0, boxshape.m_min, boxshape.m_max);
296 shape1->getAabb(trans1, boxshape.m_min, boxshape.m_max);
303 shape0->
getChildAabb(i, trans0, boxshape0.m_min, boxshape0.m_max);
305 if (boxshape.has_collision(boxshape0))
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
544 if (shape1->isCompound())
550 else if (shape1->isConcave())
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)
636 int i = shape1->getNumChildShapes();
640 btTransform childtrans1 = orgtrans1 * shape1->getChildTransform(i);
657 shape0, colshape1, swapped);
686 shape0->
getAabb(orgtrans0, tribox.m_min, tribox.m_max);
687 tribox.increment_margin(planeshape->getMargin());
700 vertex = orgtrans0(vertex);
792 tricallback.
margin = shape1->getMargin();
800 shape0->
getAabb(gimpactInConcaveSpace, minAABB, maxAABB);
802 shape1->processAllTriangles(&tricallback, minAABB, maxAABB);
typedef float(TangentPoint)[2]
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
ATTR_WARN_UNUSED_RESULT const BMVert * v
@ GIMPACT_SHAPE_PROXYTYPE
Used for GIMPACT Trimesh integration.
@ MAX_BROADPHASE_COLLISION_TYPES
btCollisionShape
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
btCompoundShape(bool enableDynamicAabbTree=true, const int initialChildCapacity=0)
@ 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...
btStaticPlaneShape(const btVector3 &planeNormal, btScalar planeConstant)
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
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
btTetrahedronShapeEx m_tetrashape
const btCollisionShape * getChildShape(int index)
btTriangleShapeEx m_trishape
TriangleShapeRetriever m_tri_retriever
const btGImpactShapeInterface * m_gim_shape
ChildShapeRetriever m_child_retriever
This class is not enabled yet (work-in-progress) to more aggressively activate objects.
SIMD_FORCE_INLINE int size() const
return the number of elements in the array
SIMD_FORCE_INLINE 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()
btDispatcher * m_dispatcher
virtual void processCollision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)=0
virtual ~btCollisionAlgorithm()
void registerCollisionCreateFunc(int proxyType0, int proxyType1, btCollisionAlgorithmCreateFunc *createFunc)
registerCollisionCreateFunc allows registration of custom/alternative collision create functions
virtual void freeCollisionAlgorithm(void *ptr)=0
Collision Algorithm for GImpact Shapes.
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.
void collide_gjk_triangles(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactMeshShapePart *shape0, const btGImpactMeshShapePart *shape1, const int *pairs, int pair_count)
btCollisionAlgorithm * m_convex_algorithm
const btDispatcherInfo * m_dispatchInfo
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)
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)
SIMD_FORCE_INLINE btPersistentManifold * getLastManifold()
void gimpact_vs_shape(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btGImpactShapeInterface *shape0, const btCollisionShape *shape1, bool swapped)
btPersistentManifold * m_manifoldPtr
virtual ~btGImpactCollisionAlgorithm()
btManifoldResult * internalGetResultOut()
btManifoldResult * m_resultOut
void convex_vs_convex_collision(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap, const btCollisionShape *shape0, const btCollisionShape *shape1)
static void registerAlgorithm(btCollisionDispatcher *dispatcher)
Use this function for register the algorithm externally.
SIMD_FORCE_INLINE void clearCache()
SIMD_FORCE_INLINE btCollisionAlgorithm * newAlgorithm(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
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)
SIMD_FORCE_INLINE void checkConvexAlgorithm(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
SIMD_FORCE_INLINE void checkManifold(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
This class manages a sub part of a mesh supplied by the btStridingMeshInterface interface.
SIMD_FORCE_INLINE int getVertexCount() const
SIMD_FORCE_INLINE void getVertex(int vertex_index, btVector3 &vertex) const
virtual void getBulletTriangle(int prim_index, btTriangleShapeEx &triangle) const
virtual void lockChildShapes() const
call when reading child shapes
SIMD_FORCE_INLINE btScalar getMargin() const
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.
SIMD_FORCE_INLINE void getPrimitiveTriangle(int index, btPrimitiveTriangle &triangle) const
if this trimesh
virtual void getChildAabb(int child_index, const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
Retrieves the bound from a child.
virtual eGIMPACT_SHAPE_TYPE getGImpactShapeType() const =0
Base method for determinig which kind of GIMPACT shape we get.
SIMD_FORCE_INLINE const btGImpactBoxSet * getBoxSet() const
gets boxset
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 btCollisionShape * getChildShape(int index)=0
Gets the children.
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
SIMD_FORCE_INLINE bool hasBoxSet() const
Determines if this class has a hierarchy structure for sorting its primitives.
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
const btCollisionObjectWrapper * getBody0Wrap() const
void setBody1Wrap(const btCollisionObjectWrapper *obj1Wrap)
virtual void setShapeIdentifiersB(int partId1, int index1)
SIMD_FORCE_INLINE void refreshContactPoints()
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)
SIMD_FORCE_INLINE void buildTriPlane()
Helper class for tetrahedrons.
Helper class for colliding Bullet Triangle Shapes.
bool overlap_test_conservative(const btTriangleShapeEx &other)
class btTriangleShapeEx: public btTriangleShape
IconTextureDrawCall normal
T distance(const T &a, const T &b)
SIMD_FORCE_INLINE const btCollisionShape * getCollisionShape() const
SIMD_FORCE_INLINE const btTransform & getWorldTransform() const
SIMD_FORCE_INLINE const btCollisionObject * getCollisionObject() const