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. It is recommended to use quantization for better performance and lower memory requirements.
Definition at line 166 of file btQuantizedBvh.h.
Enumerator | |
---|---|
TRAVERSAL_STACKLESS | |
TRAVERSAL_STACKLESS_CACHE_FRIENDLY | |
TRAVERSAL_RECURSIVE |
Definition at line 170 of file btQuantizedBvh.h.
btQuantizedBvh::btQuantizedBvh | ( | ) |
Definition at line 24 of file btQuantizedBvh.cpp.
|
virtual |
Definition at line 112 of file btQuantizedBvh.cpp.
|
private |
Definition at line 1112 of file btQuantizedBvh.cpp.
|
protected |
Definition at line 784 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 36 of file btQuantizedBvh.cpp.
|
protected |
Definition at line 121 of file btQuantizedBvh.cpp.
|
protected |
Definition at line 285 of file btQuantizedBvh.cpp.
unsigned btQuantizedBvh::calculateSerializeBufferSize | ( | ) | const |
Definition at line 813 of file btQuantizedBvh.cpp.
|
inlinevirtual |
Definition at line 538 of file btQuantizedBvh.h.
|
virtual |
Definition at line 1190 of file btQuantizedBvh.cpp.
|
virtual |
Definition at line 1119 of file btQuantizedBvh.cpp.
|
static |
deSerializeInPlace loads and initializes a BVH from a buffer in memory 'in place'
Definition at line 1006 of file btQuantizedBvh.cpp.
|
inlineprotected |
Definition at line 233 of file btQuantizedBvh.h.
|
inlineprotected |
Definition at line 224 of file btQuantizedBvh.h.
|
static |
Definition at line 807 of file btQuantizedBvh.cpp.
|
inline |
Definition at line 317 of file btQuantizedBvh.h.
|
inline |
Definition at line 418 of file btQuantizedBvh.h.
|
inline |
Definition at line 423 of file btQuantizedBvh.h.
|
inline |
Definition at line 453 of file btQuantizedBvh.h.
|
inlineprotected |
Definition at line 255 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 326 of file btQuantizedBvh.h.
|
inline |
Definition at line 390 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 312 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 742 of file btQuantizedBvh.cpp.
void btQuantizedBvh::reportRayOverlappingNodex | ( | btNodeOverlapCallback * | nodeCallback, |
const btVector3 & | raySource, | ||
const btVector3 & | rayTarget | ||
) | const |
Definition at line 737 of file btQuantizedBvh.cpp.
|
virtual |
fills the dataBuffer and returns the struct name (and 0 on failure)
Definition at line 1262 of file btQuantizedBvh.cpp.
|
virtual |
Data buffer MUST be 16 byte aligned.
Definition at line 824 of file btQuantizedBvh.cpp.
|
inlineprotected |
Definition at line 212 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 201 of file btQuantizedBvh.h.
|
inlineprotected |
Definition at line 243 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 81 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 413 of file btQuantizedBvh.h.
|
protected |
Definition at line 232 of file btQuantizedBvh.cpp.
|
protected |
Definition at line 768 of file btQuantizedBvh.cpp.
|
inline |
Definition at line 401 of file btQuantizedBvh.h.
|
protected |
Definition at line 200 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 411 of file btQuantizedBvh.cpp.
|
protected |
Definition at line 653 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 530 of file btQuantizedBvh.cpp.
|
protected |
tree traversal designed for small-memory processors like PS3 SPU
Definition at line 716 of file btQuantizedBvh.cpp.
|
protected |
Definition at line 349 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 442 of file btQuantizedBvh.cpp.
|
protected |
Definition at line 182 of file btQuantizedBvh.h.
|
protected |
Definition at line 179 of file btQuantizedBvh.h.
|
protected |
Definition at line 178 of file btQuantizedBvh.h.
|
protected |
Definition at line 180 of file btQuantizedBvh.h.
|
protected |
Definition at line 189 of file btQuantizedBvh.h.
|
protected |
Definition at line 184 of file btQuantizedBvh.h.
|
protected |
Definition at line 188 of file btQuantizedBvh.h.
|
protected |
Definition at line 191 of file btQuantizedBvh.h.
|
protected |
Definition at line 190 of file btQuantizedBvh.h.
|
mutableprotected |
Definition at line 197 of file btQuantizedBvh.h.
|
protected |
Definition at line 194 of file btQuantizedBvh.h.
|
protected |
Definition at line 193 of file btQuantizedBvh.h.
|
protected |
Definition at line 186 of file btQuantizedBvh.h.