Bullet Collision Detection & Physics Library: btOptimizedBvh Class Reference

Bullet Collision Detection & Physics Library

Public Member Functions | Static Public Member Functions | List of all members
btOptimizedBvh Class Reference

The btOptimizedBvh extends the btQuantizedBvh to create AABB tree for triangle meshes, through the btStridingMeshInterface. More...

`#include <btOptimizedBvh.h>`

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

## Public Member Functions
| BT_DECLARE_ALIGNED_ALLOCATOR ()
| btOptimizedBvh ()
virtual | ~btOptimizedBvh ()
void | build (btStridingMeshInterface *triangles, bool useQuantizedAabbCompression, const btVector3 &bvhAabbMin, const btVector3 &bvhAabbMax)
void | refit (btStridingMeshInterface *triangles, const btVector3 &aabbMin, const btVector3 &aabbMax)
void | refitPartial (btStridingMeshInterface *triangles, const btVector3 &aabbMin, const btVector3 &aabbMax)
void | updateBvhNodes (btStridingMeshInterface *meshInterface, int firstNode, int endNode, int index)
virtual bool | serializeInPlace (void *o_alignedDataBuffer, unsigned i_dataBufferSize, bool i_swapEndian) const
| Data buffer MUST be 16 byte aligned. More...
Public Member Functions inherited from btQuantizedBvh
| BT_DECLARE_ALIGNED_ALLOCATOR ()
| btQuantizedBvh ()
virtual | ~btQuantizedBvh ()
void | setQuantizationValues (const btVector3 &bvhAabbMin, const btVector3 &bvhAabbMax, btScalar quantizationMargin=btScalar(1.0))
| ***************************************** expert/internal use only ************************* More...
QuantizedNodeArray & | getLeafNodeArray ()
void | buildInternal ()
| buildInternal is expert use only: assumes that setQuantizationValues and LeafNodeArray are initialized More...
void | reportAabbOverlappingNodex (btNodeOverlapCallback *nodeCallback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
| ***************************************** expert/internal use only ************************* More...
void | reportRayOverlappingNodex (btNodeOverlapCallback *nodeCallback, const btVector3 &raySource, const btVector3 &rayTarget) const
void | reportBoxCastOverlappingNodex (btNodeOverlapCallback *nodeCallback, const btVector3 &raySource, const btVector3 &rayTarget, const btVector3 &aabbMin, const btVector3 &aabbMax) const
void | quantize (unsigned short *out, const btVector3 &point, int isMax) const
void | quantizeWithClamp (unsigned short *out, const btVector3 &point2, int isMax) const
btVector3 | unQuantize (const unsigned short *vecIn) const
void | setTraversalMode (btTraversalMode traversalMode)
| setTraversalMode let's you choose between stackless, recursive or stackless cache friendly tree traversal. Note this is only implemented for quantized trees. More...
QuantizedNodeArray & | getQuantizedNodeArray ()
BvhSubtreeInfoArray & | getSubtreeInfoArray ()
unsigned | calculateSerializeBufferSize () const
virtual bool | serialize (void *o_alignedDataBuffer, unsigned i_dataBufferSize, bool i_swapEndian) const
| Data buffer MUST be 16 byte aligned. More...
virtual int | calculateSerializeBufferSizeNew () 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 | deSerializeFloat (struct btQuantizedBvhFloatData &quantizedBvhFloatData)
virtual void | deSerializeDouble (struct btQuantizedBvhDoubleData &quantizedBvhDoubleData)
bool | isQuantized ()

## Static Public Member Functions
static btOptimizedBvh * | deSerializeInPlace (void *i_alignedDataBuffer, unsigned int i_dataBufferSize, bool i_swapEndian)
| deSerializeInPlace loads and initializes a BVH from a buffer in memory 'in place' More...
Static Public Member Functions inherited from btQuantizedBvh
static btQuantizedBvh * | deSerializeInPlace (void *i_alignedDataBuffer, unsigned int i_dataBufferSize, bool i_swapEndian)
| deSerializeInPlace loads and initializes a BVH from a buffer in memory 'in place' More...
static unsigned int | getAlignmentSerializationPadding ()

## Additional Inherited Members
Public Types inherited from btQuantizedBvh
enum | btTraversalMode { TRAVERSAL_STACKLESS = 0, TRAVERSAL_STACKLESS_CACHE_FRIENDLY, TRAVERSAL_RECURSIVE }
Protected Member Functions inherited from btQuantizedBvh
void | setInternalNodeAabbMin (int nodeIndex, const btVector3 &aabbMin)
| two versions, one for quantized and normal nodes. More...
void | setInternalNodeAabbMax (int nodeIndex, const btVector3 &aabbMax)
btVector3 | getAabbMin (int nodeIndex) const
btVector3 | getAabbMax (int nodeIndex) const
void | setInternalNodeEscapeIndex (int nodeIndex, int escapeIndex)
void | mergeInternalNodeAabb (int nodeIndex, const btVector3 &newAabbMin, const btVector3 &newAabbMax)
void | swapLeafNodes (int firstIndex, int secondIndex)
void | assignInternalNodeFromLeafNode (int internalNode, int leafNodeIndex)
void | buildTree (int startIndex, int endIndex)
int | calcSplittingAxis (int startIndex, int endIndex)
int | sortAndCalcSplittingIndex (int startIndex, int endIndex, int splitAxis)
void | walkStacklessTree (btNodeOverlapCallback *nodeCallback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
void | walkStacklessQuantizedTreeAgainstRay (btNodeOverlapCallback *nodeCallback, const btVector3 &raySource, const btVector3 &rayTarget, const btVector3 &aabbMin, const btVector3 &aabbMax, int startNodeIndex, int endNodeIndex) const
void | walkStacklessQuantizedTree (btNodeOverlapCallback *nodeCallback, unsigned short int *quantizedQueryAabbMin, unsigned short int *quantizedQueryAabbMax, int startNodeIndex, int endNodeIndex) const
void | walkStacklessTreeAgainstRay (btNodeOverlapCallback *nodeCallback, const btVector3 &raySource, const btVector3 &rayTarget, const btVector3 &aabbMin, const btVector3 &aabbMax, int startNodeIndex, int endNodeIndex) const
void | walkStacklessQuantizedTreeCacheFriendly (btNodeOverlapCallback *nodeCallback, unsigned short int *quantizedQueryAabbMin, unsigned short int *quantizedQueryAabbMax) const
| tree traversal designed for small-memory processors like PS3 SPU More...
void | walkRecursiveQuantizedTreeAgainstQueryAabb (const btQuantizedBvhNode *currentNode, btNodeOverlapCallback *nodeCallback, unsigned short int *quantizedQueryAabbMin, unsigned short int *quantizedQueryAabbMax) const
| use the 16-byte stackless 'skipindex' node tree to do a recursive traversal More...
void | walkRecursiveQuantizedTreeAgainstQuantizedTree (const btQuantizedBvhNode *treeNodeA, const btQuantizedBvhNode *treeNodeB, btNodeOverlapCallback *nodeCallback) const
| use the 16-byte stackless 'skipindex' node tree to do a recursive traversal More...
void | updateSubtreeHeaders (int leftChildNodexIndex, int rightChildNodexIndex)
Protected Attributes inherited from btQuantizedBvh
btVector3 | m_bvhAabbMin
btVector3 | m_bvhAabbMax
btVector3 | m_bvhQuantization
int | m_bulletVersion
int | m_curNodeIndex
bool | m_useQuantization
NodeArray | m_leafNodes
NodeArray | m_contiguousNodes
QuantizedNodeArray | m_quantizedLeafNodes
QuantizedNodeArray | m_quantizedContiguousNodes
btTraversalMode | m_traversalMode
BvhSubtreeInfoArray | m_SubtreeHeaders
int | m_subtreeHeaderCount

## Detailed Description

The btOptimizedBvh extends the btQuantizedBvh to create AABB tree for triangle meshes, through the btStridingMeshInterface.

Definition at line 26 of file btOptimizedBvh.h.

## Constructor & Destructor Documentation

## ◆ btOptimizedBvh()

btOptimizedBvh::btOptimizedBvh | ( |  | ) |

Definition at line 21 of file btOptimizedBvh.cpp.

## ◆ ~btOptimizedBvh()

btOptimizedBvh::~btOptimizedBvh | ( |  | ) |
| virtual

Definition at line 25 of file btOptimizedBvh.cpp.

## Member Function Documentation

## ◆ BT_DECLARE_ALIGNED_ALLOCATOR()

btOptimizedBvh::BT_DECLARE_ALIGNED_ALLOCATOR | ( |  | ) |

## ◆ build()

void btOptimizedBvh::build | ( | btStridingMeshInterface * | triangles,
|  | bool | useQuantizedAabbCompression,
|  | const btVector3 & | bvhAabbMin,
|  | const btVector3 & | bvhAabbMax
| ) |  |

if the entire tree is small then subtree size, we need to create a header info for the tree

Definition at line 29 of file btOptimizedBvh.cpp.

## ◆ deSerializeInPlace()

btOptimizedBvh * btOptimizedBvh::deSerializeInPlace | ( | void * | i_alignedDataBuffer,
|  | unsigned int | i_dataBufferSize,
|  | bool | i_swapEndian
| ) |  |
| static

deSerializeInPlace loads and initializes a BVH from a buffer in memory 'in place'

Definition at line 353 of file btOptimizedBvh.cpp.

## ◆ refit()

void btOptimizedBvh::refit | ( | btStridingMeshInterface * | triangles,
|  | const btVector3 & | aabbMin,
|  | const btVector3 & | aabbMax
| ) |  |

now update all subtree headers

Definition at line 191 of file btOptimizedBvh.cpp.

## ◆ refitPartial()

void btOptimizedBvh::refitPartial | ( | btStridingMeshInterface * | triangles,
|  | const btVector3 & | aabbMin,
|  | const btVector3 & | aabbMax
| ) |  |

we should update all quantization values, using updateBvhNodes(meshInterface); but we only update chunks that overlap the given aabb

Definition at line 213 of file btOptimizedBvh.cpp.

## ◆ serializeInPlace()

virtual bool btOptimizedBvh::serializeInPlace | ( | void * | o_alignedDataBuffer,
|  | unsigned | i_dataBufferSize,
|  | bool | i_swapEndian
| ) |  | const
| inlinevirtual

Data buffer MUST be 16 byte aligned.

Definition at line 47 of file btOptimizedBvh.h.

## ◆ updateBvhNodes()

void btOptimizedBvh::updateBvhNodes | ( | btStridingMeshInterface * | meshInterface,
|  | int | firstNode,
|  | int | endNode,
|  | int | index
| ) |  |

Definition at line 251 of file btOptimizedBvh.cpp.

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

- btOptimizedBvh.h
- btOptimizedBvh.cpp