Blender  V3.3
Classes | Functions | Variables
btCompoundShape.h File Reference
#include "btCollisionShape.h"
#include "LinearMath/btVector3.h"
#include "LinearMath/btTransform.h"
#include "LinearMath/btMatrix3x3.h"
#include "btCollisionMargin.h"
#include "LinearMath/btAlignedObjectArray.h"

Go to the source code of this file.

Classes

struct  btCompoundShapeChildData
 do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 More...
 
struct  btCompoundShapeData
 do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 More...
 

Functions

SIMD_FORCE_INLINE bool operator== (const btCompoundShapeChild &c1, const btCompoundShapeChild &c2)
 
 BT_DECLARE_ALIGNED_ALLOCATOR ()
 
 btCompoundShape (bool enableDynamicAabbTree=true, const int initialChildCapacity=0)
 
virtual ~btCompoundShape ()
 
void addChildShape (const btTransform &localTransform, btCollisionShape *shape)
 
virtual void removeChildShape (btCollisionShape *shape)
 Remove all children shapes that contain the specified shape. More...
 
void removeChildShapeByIndex (int childShapeindex)
 
int getNumChildShapes () const
 
btCollisionShapegetChildShape (int index)
 
btTransformgetChildTransform (int index)
 
void updateChildTransform (int childIndex, const btTransform &newChildTransform, bool shouldRecalculateLocalAabb=true)
 set a new transform for a child, and update internal data structures (local aabb and dynamic tree) More...
 
btCompoundShapeChildgetChildList ()
 
virtual void getAabb (const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
 getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version More...
 
virtual void recalculateLocalAabb ()
 
virtual void setLocalScaling (const btVector3 &scaling)
 
virtual const btVector3getLocalScaling () const
 
virtual void calculateLocalInertia (btScalar mass, btVector3 &inertia) const
 CollisionShape Interface. More...
 
virtual void setMargin (btScalar margin)
 
virtual btScalar getMargin () const
 
virtual const char * getName () const
 
const btDbvtgetDynamicAabbTree () const
 
void createAabbTreeFromChildren ()
 
void calculatePrincipalAxisTransform (const btScalar *masses, btTransform &principal, btVector3 &inertia) const
 
int getUpdateRevision () 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...
 

Variables

 btCompoundShapeChild
 
btTransform m_transform
 
btCollisionShapem_childShape
 
int m_childShapeType
 
btScalar m_childMargin
 
struct btDbvtNodem_node
 
btCompoundShape __pad0__
 
btVector3 m_localAabbMin
 
btVector3 m_localAabbMax
 
btDbvtm_dynamicAabbTree
 
int m_updateRevision
 increment m_updateRevision when adding/removing/replacing child shapes, so that some caches can be updated More...
 
btScalar m_collisionMargin
 
btVector3 m_localScaling
 

Function Documentation

◆ addChildShape()

void addChildShape ( const btTransform localTransform,
btCollisionShape shape 
)

◆ BT_DECLARE_ALIGNED_ALLOCATOR()

BT_DECLARE_ALIGNED_ALLOCATOR ( )

◆ btCompoundShape()

btCompoundShape::btCompoundShape ( bool  enableDynamicAabbTree = true,
const int  initialChildCapacity = 0 
)
explicit

◆ calculateLocalInertia()

virtual void calculateLocalInertia ( btScalar  mass,
btVector3 inertia 
) const
virtual

CollisionShape Interface.

Definition at line 54 of file btConeShape.h.

◆ calculatePrincipalAxisTransform()

void btCompoundShape::calculatePrincipalAxisTransform ( const btScalar masses,
btTransform principal,
btVector3 inertia 
) const

computes the exact moment of inertia and the transform from the coordinate system defined by the principal axes of the moment of inertia and the center of mass to the current coordinate system. "masses" points to an array of masses of the children. The resulting transform "principal" has to be applied inversely to all children transforms in order for the local coordinate system of the compound shape to be centered at the center of mass and to coincide with the principal axes. This also necessitates a correction of the world transform of the collision object by the principal transform.

Definition at line 202 of file btCompoundShape.cpp.

References btAssert, btMatrix3x3, btTransform, btVector3, center, and t.

◆ calculateSerializeBufferSize()

virtual int calculateSerializeBufferSize ( ) const
virtual

◆ createAabbTreeFromChildren()

void btCompoundShape::createAabbTreeFromChildren ( )

◆ getAabb()

virtual void getAabb ( const btTransform t,
btVector3 aabbMin,
btVector3 aabbMax 
) const
virtual

getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version

getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version

getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t.

Definition at line 54 of file btCapsuleShape.h.

◆ getChildList()

btCompoundShapeChild* getChildList ( )

Definition at line 112 of file btCompoundShape.h.

◆ getChildShape()

const btCollisionShape * getChildShape ( int  index)

Definition at line 91 of file btCompoundShape.h.

Referenced by btAdjustInternalEdgeContacts().

◆ getChildTransform()

const btTransform & getChildTransform ( int  index)

Definition at line 100 of file btCompoundShape.h.

◆ getDynamicAabbTree()

btDbvt * getDynamicAabbTree ( ) const

Definition at line 146 of file btCompoundShape.h.

References m_dynamicAabbTree.

◆ getLocalScaling()

virtual const btVector3& getLocalScaling ( ) const
virtual

Definition at line 126 of file btCompoundShape.h.

◆ getMargin()

virtual btScalar getMargin ( ) const
virtual

Definition at line 137 of file btCompoundShape.h.

◆ getName()

virtual const char* getName ( ) const
virtual

Definition at line 141 of file btCompoundShape.h.

◆ getNumChildShapes()

int getNumChildShapes ( ) const

◆ getUpdateRevision()

int getUpdateRevision ( ) const

Definition at line 165 of file btCompoundShape.h.

References m_updateRevision.

◆ operator==()

SIMD_FORCE_INLINE bool operator== ( const btCompoundShapeChild c1,
const btCompoundShapeChild c2 
)

Definition at line 42 of file btCompoundShape.h.

◆ recalculateLocalAabb()

void btCompoundShape::recalculateLocalAabb ( )
virtual

Re-calculate the local Aabb. Is called at the end of removeChildShapes. Use this yourself if you modify the children or their transforms.

Definition at line 137 of file btCompoundShape.cpp.

References BT_LARGE_FLOAT, btVector3, m_localAabbMax, m_localAabbMin, and m_transform.

Referenced by addPoint(), removeChildShape(), and updateChildTransform().

◆ removeChildShape()

void btCompoundShape::removeChildShape ( btCollisionShape shape)
virtual

Remove all children shapes that contain the specified shape.

Definition at line 121 of file btCompoundShape.cpp.

References m_childShape, m_updateRevision, recalculateLocalAabb(), and removeChildShapeByIndex().

◆ removeChildShapeByIndex()

void btCompoundShape::removeChildShapeByIndex ( int  childShapeindex)

Definition at line 107 of file btCompoundShape.cpp.

References btAssert, m_dynamicAabbTree, m_node, m_updateRevision, and btDbvt::remove().

Referenced by removeChildShape().

◆ serialize()

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

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

◆ setLocalScaling()

virtual void setLocalScaling ( const btVector3 scaling)
virtual

Definition at line 120 of file btBox2dShape.h.

◆ setMargin()

virtual void setMargin ( btScalar  margin)
virtual

Definition at line 133 of file btCompoundShape.h.

References m_collisionMargin.

◆ updateChildTransform()

void btCompoundShape::updateChildTransform ( int  childIndex,
const btTransform newChildTransform,
bool  shouldRecalculateLocalAabb = true 
)

set a new transform for a child, and update internal data structures (local aabb and dynamic tree)

update the dynamic aabb tree

Definition at line 86 of file btCompoundShape.cpp.

References ATTRIBUTE_ALIGNED16, bounds(), btVector3, btDbvtAabbMm::FromMM(), m_dynamicAabbTree, m_node, recalculateLocalAabb(), and btDbvt::update().

◆ ~btCompoundShape()

btCompoundShape::~btCompoundShape ( )
virtual

Definition at line 41 of file btCompoundShape.cpp.

References btAlignedFree, m_dynamicAabbTree, and btDbvt::~btDbvt().

Variable Documentation

◆ __pad0__

btCompoundShape __pad0__

The btCompoundShape allows to store multiple other btCollisionShapes This allows for moving concave collision objects. This is more general then the static concave btBvhTriangleMeshShape. It has an (optional) dynamic aabb tree to accelerate early rejection tests.

Todo:
: This aabb tree can also be use to speed up ray tests on btCompoundShape, see http://code.google.com/p/bullet/issues/detail?id=25 Currently, removal of child shapes is only supported when disabling the aabb tree (pass 'false' in the constructor of btCompoundShape)

Definition at line 56 of file btCompoundShape.h.

◆ btCompoundShapeChild

btCompoundShapeChild
Initial value:

Definition at line 31 of file btCompoundShape.h.

Referenced by createAabbTreeFromChildren().

◆ m_childMargin

btScalar m_childMargin

Definition at line 38 of file btCompoundShape.h.

◆ m_childShape

btCollisionShape* m_childShape

Definition at line 36 of file btCompoundShape.h.

Referenced by removeChildShape().

◆ m_childShapeType

int m_childShapeType

Definition at line 37 of file btCompoundShape.h.

◆ m_collisionMargin

btScalar m_collisionMargin

◆ m_dynamicAabbTree

btDbvt* m_dynamicAabbTree

◆ m_localAabbMax

btVector3 m_localAabbMax

◆ m_localAabbMin

btVector3 m_localAabbMin

◆ m_localScaling

btVector3 m_localScaling

◆ m_node

struct btDbvtNode* m_node

◆ m_transform

btTransform m_transform

Definition at line 35 of file btCompoundShape.h.

Referenced by recalculateLocalAabb().

◆ m_updateRevision

int m_updateRevision

increment m_updateRevision when adding/removing/replacing child shapes, so that some caches can be updated

Definition at line 66 of file btCompoundShape.h.

Referenced by getUpdateRevision().