|
Bullet Collision Detection & Physics Library
|
The btQuantizedBvh class stores an AABB tree that can be quickly traversed on CPU and Cell SPU. More...
#include <btQuantizedBvh.h>


Public Types | |
| enum | btTraversalMode { TRAVERSAL_STACKLESS = 0, TRAVERSAL_STACKLESS_CACHE_FRIENDLY, TRAVERSAL_RECURSIVE } |
Public Member Functions | |
| 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 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 () |
Protected Member Functions | |
| 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) |
Private Member Functions | |
| btQuantizedBvh (btQuantizedBvh &other, bool ownsMemory) | |
The btQuantizedBvh class stores an AABB tree that can be quickly traversed on CPU and Cell SPU.
It is used by the btBvhTriangleMeshShape as midphase, and by the btMultiSapBroadphase. It is recommended to use quantization for better performance and lower memory requirements.
Definition at line 174 of file btQuantizedBvh.h.
| Enumerator | |
|---|---|
| TRAVERSAL_STACKLESS | |
| TRAVERSAL_STACKLESS_CACHE_FRIENDLY | |
| TRAVERSAL_RECURSIVE | |
Definition at line 177 of file btQuantizedBvh.h.
| btQuantizedBvh::btQuantizedBvh | ( | ) |
Definition at line 24 of file btQuantizedBvh.cpp.
|
virtual |
Definition at line 105 of file btQuantizedBvh.cpp.
|
private |
Definition at line 1138 of file btQuantizedBvh.cpp.
|
protected |
Definition at line 805 of file btQuantizedBvh.cpp.
| btQuantizedBvh::BT_DECLARE_ALIGNED_ALLOCATOR | ( | ) |
| void btQuantizedBvh::buildInternal | ( | ) |
buildInternal is expert use only: assumes that setQuantizationValues and LeafNodeArray are initialized
assumes that caller filled in the m_quantizedLeafNodes
if the entire tree is small then subtree size, we need to create a header info for the tree
Definition at line 40 of file btQuantizedBvh.cpp.
|
protected |
Definition at line 114 of file btQuantizedBvh.cpp.
|
protected |
Definition at line 284 of file btQuantizedBvh.cpp.
| unsigned btQuantizedBvh::calculateSerializeBufferSize | ( | ) | const |
Definition at line 834 of file btQuantizedBvh.cpp.
|
inlinevirtual |
Definition at line 574 of file btQuantizedBvh.h.
|
virtual |
Definition at line 1218 of file btQuantizedBvh.cpp.
|
virtual |
Definition at line 1147 of file btQuantizedBvh.cpp.
|
static |
deSerializeInPlace loads and initializes a BVH from a buffer in memory 'in place'
Definition at line 1031 of file btQuantizedBvh.cpp.
|
inlineprotected |
Definition at line 248 of file btQuantizedBvh.h.
|
inlineprotected |
Definition at line 238 of file btQuantizedBvh.h.
|
static |
Definition at line 828 of file btQuantizedBvh.cpp.
|
inline |
Definition at line 343 of file btQuantizedBvh.h.
|
inline |
Definition at line 450 of file btQuantizedBvh.h.
|
inline |
Definition at line 456 of file btQuantizedBvh.h.
|
inline |
Definition at line 488 of file btQuantizedBvh.h.
|
inlineprotected |
Definition at line 273 of file btQuantizedBvh.h.
|
inline |
Make sure rounding is done in a way that unQuantize(quantizeWithClamp(...)) is conservative end-points always set the first bit, so that they are sorted properly (so that neighbouring AABBs overlap properly)
Definition at line 352 of file btQuantizedBvh.h.
|
inline |
Definition at line 419 of file btQuantizedBvh.h.
| void btQuantizedBvh::reportAabbOverlappingNodex | ( | btNodeOverlapCallback * | nodeCallback, |
| const btVector3 & | aabbMin, | ||
| const btVector3 & | aabbMax | ||
| ) | const |
***************************************** expert/internal use only *************************
quantize query AABB
Definition at line 313 of file btQuantizedBvh.cpp.
| void btQuantizedBvh::reportBoxCastOverlappingNodex | ( | btNodeOverlapCallback * | nodeCallback, |
| const btVector3 & | raySource, | ||
| const btVector3 & | rayTarget, | ||
| const btVector3 & | aabbMin, | ||
| const btVector3 & | aabbMax | ||
| ) | const |
Definition at line 762 of file btQuantizedBvh.cpp.
| void btQuantizedBvh::reportRayOverlappingNodex | ( | btNodeOverlapCallback * | nodeCallback, |
| const btVector3 & | raySource, | ||
| const btVector3 & | rayTarget | ||
| ) | const |
Definition at line 756 of file btQuantizedBvh.cpp.
|
virtual |
Data buffer MUST be 16 byte aligned.
Definition at line 845 of file btQuantizedBvh.cpp.
|
virtual |
fills the dataBuffer and returns the struct name (and 0 on failure)
Definition at line 1293 of file btQuantizedBvh.cpp.
|
inlineprotected |
Definition at line 227 of file btQuantizedBvh.h.
|
inlineprotected |
two versions, one for quantized and normal nodes.
This allows code-reuse while maintaining readability (no template/macro!) this might be refactored into a virtual, it is usually not calculated at run-time
Definition at line 216 of file btQuantizedBvh.h.
|
inlineprotected |
Definition at line 260 of file btQuantizedBvh.h.
| void btQuantizedBvh::setQuantizationValues | ( | const btVector3 & | bvhAabbMin, |
| const btVector3 & | bvhAabbMax, | ||
| btScalar | quantizationMargin = btScalar(1.0) |
||
| ) |
***************************************** expert/internal use only *************************
just for debugging, to visualize the individual patches/subtrees
Definition at line 91 of file btQuantizedBvh.cpp.
|
inline |
setTraversalMode let's you choose between stackless, recursive or stackless cache friendly tree traversal. Note this is only implemented for quantized trees.
Definition at line 444 of file btQuantizedBvh.h.
|
protected |
Definition at line 230 of file btQuantizedBvh.cpp.
|
protected |
Definition at line 790 of file btQuantizedBvh.cpp.
|
inline |
Definition at line 432 of file btQuantizedBvh.h.
|
protected |
Definition at line 197 of file btQuantizedBvh.cpp.
|
protected |
use the 16-byte stackless 'skipindex' node tree to do a recursive traversal
|
protected |
use the 16-byte stackless 'skipindex' node tree to do a recursive traversal
Definition at line 417 of file btQuantizedBvh.cpp.
|
protected |
Definition at line 667 of file btQuantizedBvh.cpp.
|
protected |
what about division by zero? –> just set rayDirection[i] to 1.0
careful with this check: need to check division by zero (above) and fix the unQuantize method thanks Joerg/hiker for the reproduction case! http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=1858
Definition at line 541 of file btQuantizedBvh.cpp.
|
protected |
tree traversal designed for small-memory processors like PS3 SPU
Definition at line 733 of file btQuantizedBvh.cpp.
|
protected |
Definition at line 353 of file btQuantizedBvh.cpp.
|
protected |
what about division by zero? –> just set rayDirection[i] to 1.0
careful with this check: need to check division by zero (above) and fix the unQuantize method thanks Joerg/hiker for the reproduction case! http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=9&t=1858
Definition at line 449 of file btQuantizedBvh.cpp.
|
protected |
Definition at line 191 of file btQuantizedBvh.h.
|
protected |
Definition at line 188 of file btQuantizedBvh.h.
|
protected |
Definition at line 187 of file btQuantizedBvh.h.
|
protected |
Definition at line 189 of file btQuantizedBvh.h.
|
protected |
Definition at line 200 of file btQuantizedBvh.h.
|
protected |
Definition at line 193 of file btQuantizedBvh.h.
|
protected |
Definition at line 199 of file btQuantizedBvh.h.
|
protected |
Definition at line 202 of file btQuantizedBvh.h.
|
protected |
Definition at line 201 of file btQuantizedBvh.h.
|
mutableprotected |
Definition at line 208 of file btQuantizedBvh.h.
|
protected |
Definition at line 205 of file btQuantizedBvh.h.
|
protected |
Definition at line 204 of file btQuantizedBvh.h.
|
protected |
Definition at line 195 of file btQuantizedBvh.h.
1.8.4