Bullet Collision Detection & Physics Library: btBvhTriangleMeshShape Class Reference

Bullet Collision Detection & Physics Library

Public Member Functions | Private Attributes | List of all members
btBvhTriangleMeshShape Class Reference

The btBvhTriangleMeshShape is a static-triangle mesh shape, it can only be used for fixed/non-moving objects. More...

`#include <btBvhTriangleMeshShape.h>`

Inheritance diagram for btBvhTriangleMeshShape:
[legend]
Collaboration diagram for btBvhTriangleMeshShape:
[legend]

## Public Member Functions
| BT_DECLARE_ALIGNED_ALLOCATOR ()
| btBvhTriangleMeshShape (btStridingMeshInterface *meshInterface, bool useQuantizedAabbCompression, bool buildBvh=true)
| Bvh Concave triangle mesh is a static-triangle mesh shape with Bounding Volume Hierarchy optimization. More...
| btBvhTriangleMeshShape (btStridingMeshInterface *meshInterface, bool useQuantizedAabbCompression, const btVector3 &bvhAabbMin, const btVector3 &bvhAabbMax, bool buildBvh=true)
| optionally pass in a larger bvh aabb, used for quantization. This allows for deformations within this aabb More...
virtual | ~btBvhTriangleMeshShape ()
bool | getOwnsBvh () const
void | performRaycast (btTriangleCallback *callback, const btVector3 &raySource, const btVector3 &rayTarget)
void | performConvexcast (btTriangleCallback *callback, const btVector3 &boxSource, const btVector3 &boxTarget, const btVector3 &boxMin, const btVector3 &boxMax)
virtual void | processAllTriangles (btTriangleCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
void | refitTree (const btVector3 &aabbMin, const btVector3 &aabbMax)
void | partialRefitTree (const btVector3 &aabbMin, const btVector3 &aabbMax)
| for a fast incremental refit of parts of the tree. Note: the entire AABB of the tree will become more conservative, it never shrinks More...
virtual const char * | getName () const
virtual void | setLocalScaling (const btVector3 &scaling)
btOptimizedBvh * | getOptimizedBvh ()
void | setOptimizedBvh (btOptimizedBvh *bvh, const btVector3 &localScaling=btVector3(1, 1, 1))
void | buildOptimizedBvh ()
bool | usesQuantizedAabbCompression () const
void | setTriangleInfoMap (btTriangleInfoMap *triangleInfoMap)
const btTriangleInfoMap * | getTriangleInfoMap () const
btTriangleInfoMap * | getTriangleInfoMap ()
virtual int | calculateSerializeBufferSize () const
virtual const char * | serialize (void *dataBuffer, btSerializer *serializer) const
| fills the dataBuffer and returns the struct name (and 0 on failure) More...
virtual void | serializeSingleBvh (btSerializer *serializer) const
virtual void | serializeSingleTriangleInfoMap (btSerializer *serializer) const
Public Member Functions inherited from btTriangleMeshShape
| BT_DECLARE_ALIGNED_ALLOCATOR ()
virtual | ~btTriangleMeshShape ()
virtual btVector3 | localGetSupportingVertex (const btVector3 &vec) const
virtual btVector3 | localGetSupportingVertexWithoutMargin (const btVector3 &vec) const
void | recalcLocalAabb ()
virtual void | getAabb (const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
| getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t. More...
virtual void | processAllTriangles (btTriangleCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
virtual void | calculateLocalInertia (btScalar mass, btVector3 &inertia) const
virtual void | setLocalScaling (const btVector3 &scaling)
virtual const btVector3 & | getLocalScaling () const
btStridingMeshInterface * | getMeshInterface ()
const btStridingMeshInterface * | getMeshInterface () const
const btVector3 & | getLocalAabbMin () const
const btVector3 & | getLocalAabbMax () const
virtual const char * | getName () const
Public Member Functions inherited from btConcaveShape
| BT_DECLARE_ALIGNED_ALLOCATOR ()
| btConcaveShape ()
virtual | ~btConcaveShape ()
virtual void | processAllTriangles (btTriangleCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const =0
virtual btScalar | getMargin () const
virtual void | setMargin (btScalar collisionMargin)
Public Member Functions inherited from btCollisionShape
| BT_DECLARE_ALIGNED_ALLOCATOR ()
| btCollisionShape ()
virtual | ~btCollisionShape ()
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. More...
virtual void | getBoundingSphere (btVector3 &center, btScalar &radius) const
virtual btScalar | getAngularMotionDisc () const
| getAngularMotionDisc returns the maximum radius needed for Conservative Advancement to handle time-of-impact with rotations. More...
virtual btScalar | getContactBreakingThreshold (btScalar defaultContactThresholdFactor) const
void | calculateTemporalAabb (const btTransform &curTrans, const btVector3 &linvel, const btVector3 &angvel, btScalar timeStep, btVector3 &temporalAabbMin, btVector3 &temporalAabbMax) const
| calculateTemporalAabb calculates the enclosing aabb for the moving object over interval [0..timeStep) result is conservative More...
bool | isPolyhedral () const
bool | isConvex2d () const
bool | isConvex () const
bool | isNonMoving () const
bool | isConcave () const
bool | isCompound () const
bool | isSoftBody () const
bool | isInfinite () const
| isInfinite is used to catch simulation error (aabb check) More...
virtual void | setLocalScaling (const btVector3 &scaling)=0
virtual const btVector3 & | getLocalScaling () const =0
virtual void | calculateLocalInertia (btScalar mass, btVector3 &inertia) const =0
virtual const char * | getName () const =0
int | getShapeType () const
virtual btVector3 | getAnisotropicRollingFrictionDirection () const
| the getAnisotropicRollingFrictionDirection can be used in combination with setAnisotropicFriction See Bullet/Demos/RollingFrictionDemo for an example More...
virtual void | setMargin (btScalar margin)=0
virtual btScalar | getMargin () const =0
void | setUserPointer (void *userPtr)
| optional user data pointer More...
void * | getUserPointer () const
void | setUserIndex (int index)
int | getUserIndex () const
void | setUserIndex2 (int index)
int | getUserIndex2 () const
virtual int | calculateSerializeBufferSize () const
virtual const char * | serialize (void *dataBuffer, btSerializer *serializer) const
| fills the dataBuffer and returns the struct name (and 0 on failure) More...
virtual void | serializeSingleShape (btSerializer *serializer) const

## Private Attributes
btOptimizedBvh * | m_bvh
btTriangleInfoMap * | m_triangleInfoMap
bool | m_useQuantizedAabbCompression
bool | m_ownsBvh
bool | m_pad [11]

## Additional Inherited Members
Protected Member Functions inherited from btTriangleMeshShape
| btTriangleMeshShape (btStridingMeshInterface *meshInterface)
| btTriangleMeshShape constructor has been disabled/protected, so that users will not mistakenly use this class. More...
Protected Attributes inherited from btTriangleMeshShape
btVector3 | m_localAabbMin
btVector3 | m_localAabbMax
btStridingMeshInterface * | m_meshInterface
Protected Attributes inherited from btConcaveShape
btScalar | m_collisionMargin
Protected Attributes inherited from btCollisionShape
int | m_shapeType
void * | m_userPointer
int | m_userIndex
int | m_userIndex2

## Detailed Description

The btBvhTriangleMeshShape is a static-triangle mesh shape, it can only be used for fixed/non-moving objects.

If you required moving concave triangle meshes, it is recommended to perform convex decomposition using HACD, see Bullet/Demos/ConvexDecompositionDemo. Alternatively, you can use btGimpactMeshShape for moving concave triangle meshes. btBvhTriangleMeshShape has several optimizations, such as bounding volume hierarchy and cache friendly traversal for PlayStation 3 Cell SPU. It is recommended to enable useQuantizedAabbCompression for better memory usage. It takes a triangle mesh as input, for example a btTriangleMesh or btTriangleIndexVertexArray. The btBvhTriangleMeshShape class allows for triangle mesh deformations by a refit or partialRefit method. Instead of building the bounding volume hierarchy acceleration structure, it is also possible to serialize (save) and deserialize (load) the structure from disk. See Demos\ConcaveDemo\ConcavePhysicsDemo.cpp for an example.

Definition at line 34 of file btBvhTriangleMeshShape.h.

## Constructor & Destructor Documentation

## ◆ btBvhTriangleMeshShape() [1/2]

btBvhTriangleMeshShape::btBvhTriangleMeshShape | ( | btStridingMeshInterface * | meshInterface,
|  | bool | useQuantizedAabbCompression,
|  | bool | buildBvh = `true`
| ) |  |

Bvh Concave triangle mesh is a static-triangle mesh shape with Bounding Volume Hierarchy optimization.

Uses an interface to access the triangles to allow for sharing graphics/physics triangles.

Definition at line 24 of file btBvhTriangleMeshShape.cpp.

## ◆ btBvhTriangleMeshShape() [2/2]

btBvhTriangleMeshShape::btBvhTriangleMeshShape | ( | btStridingMeshInterface * | meshInterface,
|  | bool | useQuantizedAabbCompression,
|  | const btVector3 & | bvhAabbMin,
|  | const btVector3 & | bvhAabbMax,
|  | bool | buildBvh = `true`
| ) |  |

optionally pass in a larger bvh aabb, used for quantization. This allows for deformations within this aabb

Definition at line 43 of file btBvhTriangleMeshShape.cpp.

## ◆ ~btBvhTriangleMeshShape()

btBvhTriangleMeshShape::~btBvhTriangleMeshShape | ( |  | ) |
| virtual

Definition at line 81 of file btBvhTriangleMeshShape.cpp.

## Member Function Documentation

## ◆ BT_DECLARE_ALIGNED_ALLOCATOR()

btBvhTriangleMeshShape::BT_DECLARE_ALIGNED_ALLOCATOR | ( |  | ) |

## ◆ buildOptimizedBvh()

void btBvhTriangleMeshShape::buildOptimizedBvh | ( |  | ) |

m_localAabbMin/m_localAabbMax is already re-calculated in btTriangleMeshShape. We could just scale aabb, but this needs some more work

Definition at line 340 of file btBvhTriangleMeshShape.cpp.

## ◆ calculateSerializeBufferSize()

int btBvhTriangleMeshShape::calculateSerializeBufferSize | ( |  | ) | const
| inlinevirtual

Reimplemented from btCollisionShape.

Definition at line 139 of file btBvhTriangleMeshShape.h.

## ◆ getName()

virtual const char * btBvhTriangleMeshShape::getName | ( |  | ) | const
| inlinevirtual

Reimplemented from btTriangleMeshShape.

Reimplemented in btMultimaterialTriangleMeshShape.

Definition at line 74 of file btBvhTriangleMeshShape.h.

## ◆ getOptimizedBvh()

btOptimizedBvh * btBvhTriangleMeshShape::getOptimizedBvh | ( |  | ) |
| inline

Definition at line 78 of file btBvhTriangleMeshShape.h.

## ◆ getOwnsBvh()

bool btBvhTriangleMeshShape::getOwnsBvh | ( |  | ) | const
| inline

Definition at line 58 of file btBvhTriangleMeshShape.h.

## ◆ getTriangleInfoMap() [1/2]

btTriangleInfoMap * btBvhTriangleMeshShape::getTriangleInfoMap | ( |  | ) |
| inline

Definition at line 102 of file btBvhTriangleMeshShape.h.

## ◆ getTriangleInfoMap() [2/2]

const btTriangleInfoMap * btBvhTriangleMeshShape::getTriangleInfoMap | ( |  | ) | const
| inline

Definition at line 97 of file btBvhTriangleMeshShape.h.

## ◆ partialRefitTree()

void btBvhTriangleMeshShape::partialRefitTree | ( | const btVector3 & | aabbMin,
|  | const btVector3 & | aabbMax
| ) |  |

for a fast incremental refit of parts of the tree. Note: the entire AABB of the tree will become more conservative, it never shrinks

Definition at line 66 of file btBvhTriangleMeshShape.cpp.

## ◆ performConvexcast()

void btBvhTriangleMeshShape::performConvexcast | ( | btTriangleCallback * | callback,
|  | const btVector3 & | boxSource,
|  | const btVector3 & | boxTarget,
|  | const btVector3 & | boxMin,
|  | const btVector3 & | boxMax
| ) |  |

Definition at line 164 of file btBvhTriangleMeshShape.cpp.

## ◆ performRaycast()

void btBvhTriangleMeshShape::performRaycast | ( | btTriangleCallback * | callback,
|  | const btVector3 & | raySource,
|  | const btVector3 & | rayTarget
| ) |  |

Definition at line 90 of file btBvhTriangleMeshShape.cpp.

## ◆ processAllTriangles()

void btBvhTriangleMeshShape::processAllTriangles | ( | btTriangleCallback * | callback,
|  | const btVector3 & | aabbMin,
|  | const btVector3 & | aabbMax
| ) |  | const
| virtual

Reimplemented from btTriangleMeshShape.

Definition at line 239 of file btBvhTriangleMeshShape.cpp.

## ◆ refitTree()

void btBvhTriangleMeshShape::refitTree | ( | const btVector3 & | aabbMin,
|  | const btVector3 & | aabbMax
| ) |  |

Definition at line 74 of file btBvhTriangleMeshShape.cpp.

## ◆ serialize()

const char * btBvhTriangleMeshShape::serialize | ( | void * | dataBuffer,
|  | btSerializer * | serializer
| ) |  | const
| virtual

fills the dataBuffer and returns the struct name (and 0 on failure)

Reimplemented from btCollisionShape.

Definition at line 370 of file btBvhTriangleMeshShape.cpp.

## ◆ serializeSingleBvh()

void btBvhTriangleMeshShape::serializeSingleBvh | ( | btSerializer * | serializer | ) | const
| virtual

Definition at line 442 of file btBvhTriangleMeshShape.cpp.

## ◆ serializeSingleTriangleInfoMap()

void btBvhTriangleMeshShape::serializeSingleTriangleInfoMap | ( | btSerializer * | serializer | ) | const
| virtual

Definition at line 453 of file btBvhTriangleMeshShape.cpp.

## ◆ setLocalScaling()

void btBvhTriangleMeshShape::setLocalScaling | ( | const btVector3 & | scaling | ) |
| virtual

Reimplemented from btTriangleMeshShape.

Definition at line 331 of file btBvhTriangleMeshShape.cpp.

## ◆ setOptimizedBvh()

void btBvhTriangleMeshShape::setOptimizedBvh | ( | btOptimizedBvh * | bvh,
|  | const btVector3 & | localScaling = `btVector3(1, 1, 1)`
| ) |  |

Definition at line 355 of file btBvhTriangleMeshShape.cpp.

## ◆ setTriangleInfoMap()

void btBvhTriangleMeshShape::setTriangleInfoMap | ( | btTriangleInfoMap * | triangleInfoMap | ) |
| inline

Definition at line 92 of file btBvhTriangleMeshShape.h.

## ◆ usesQuantizedAabbCompression()

bool btBvhTriangleMeshShape::usesQuantizedAabbCompression | ( |  | ) | const
| inline

Definition at line 87 of file btBvhTriangleMeshShape.h.

## Member Data Documentation

## ◆ m_bvh

btOptimizedBvh* btBvhTriangleMeshShape::m_bvh
| private

Definition at line 37 of file btBvhTriangleMeshShape.h.

## ◆ m_ownsBvh

bool btBvhTriangleMeshShape::m_ownsBvh
| private

Definition at line 41 of file btBvhTriangleMeshShape.h.

## ◆ m_pad

bool btBvhTriangleMeshShape::m_pad[11]
| private

Definition at line 45 of file btBvhTriangleMeshShape.h.

## ◆ m_triangleInfoMap

btTriangleInfoMap* btBvhTriangleMeshShape::m_triangleInfoMap
| private

Definition at line 38 of file btBvhTriangleMeshShape.h.

## ◆ m_useQuantizedAabbCompression

bool btBvhTriangleMeshShape::m_useQuantizedAabbCompression
| private

Definition at line 40 of file btBvhTriangleMeshShape.h.

The documentation for this class was generated from the following files:

- btBvhTriangleMeshShape.h
- btBvhTriangleMeshShape.cpp