25                                                                   m_useQuantization(
false),
 
   27                                                                   m_traversalMode(TRAVERSAL_STACKLESS)
 
   30                                                                   m_subtreeHeaderCount(0)  
 
   72#ifdef DEBUG_PATCH_COLORS 
   93                unsigned short vecIn[3];
 
  116#ifdef DEBUG_TREE_BUILDING 
  123#ifdef DEBUG_TREE_BUILDING 
  137#ifdef DEBUG_TREE_BUILDING 
  177#ifdef DEBUG_TREE_BUILDING 
  358        unsigned aabbOverlap;
 
  367                isLeafNode = 
rootNode->m_escapeIndex == -1;
 
  370                if (isLeafNode && (aabbOverlap != 0))
 
  376                if ((aabbOverlap != 0) || isLeafNode)
 
  392void    btQuantizedBvh::walkTree(btOptimizedBvhNode* rootNode,btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const
 
  394        bool isLeafNode, aabbOverlap = TestAabbAgainstAabb2(aabbMin,aabbMax,rootNode->m_aabbMin,rootNode->m_aabbMax);
 
  397                isLeafNode = (!rootNode->m_leftChild && !rootNode->m_rightChild);
 
  400                        nodeCallback->processNode(rootNode);
 
  403                        walkTree(rootNode->m_leftChild,nodeCallback,aabbMin,aabbMax);
 
  404                        walkTree(rootNode->m_rightChild,nodeCallback,aabbMin,aabbMax);
 
  417        unsigned aabbOverlap;
 
  424        if (aabbOverlap != 0)
 
  451        unsigned aabbOverlap = 0;
 
  507                isLeafNode = 
rootNode->m_escapeIndex == -1;
 
  578#ifdef VISUALLY_ANALYZE_BVH 
  602                isLeafNode = 
rootNode->isLeafNode();
 
  617                                printf(
"functions don't match\n");
 
  667        unsigned aabbOverlap;
 
  672#ifdef VISUALLY_ANALYZE_BVH 
  693                isLeafNode = 
rootNode->isLeafNode();
 
  695                if (isLeafNode && aabbOverlap)
 
  701                if ((aabbOverlap != 0) || isLeafNode)
 
  988                        targetBvh->m_SubtreeHeaders[i].m_padding[0] = 0;
 
  989                        targetBvh->m_SubtreeHeaders[i].m_padding[1] = 0;
 
  990                        targetBvh->m_SubtreeHeaders[i].m_padding[2] = 0;
 
  998        targetBvh->m_SubtreeHeaders.initializeFromBuffer(
NULL, 0, 0);
 
 1023                bvh->m_subtreeHeaderCount = 
static_cast<int>(
btSwapEndian(
bvh->m_subtreeHeaderCount));
 
 1046        if (
bvh->m_useQuantization)
 
 1062                                bvh->m_quantizedContiguousNodes[
nodeIndex].m_escapeIndexOrTriangleIndex = 
static_cast<int>(
btSwapEndian(
bvh->m_quantizedContiguousNodes[
nodeIndex].m_escapeIndexOrTriangleIndex));
 
 1090        bvh->m_SubtreeHeaders.initializeFromBuffer(
nodeData, 
bvh->m_subtreeHeaderCount, 
bvh->m_subtreeHeaderCount);
 
 1093                for (
int i = 0; i < 
bvh->m_subtreeHeaderCount; i++)
 
 1095                        bvh->m_SubtreeHeaders[i].m_quantizedAabbMin[0] = 
btSwapEndian(
bvh->m_SubtreeHeaders[i].m_quantizedAabbMin[0]);
 
 1096                        bvh->m_SubtreeHeaders[i].m_quantizedAabbMin[1] = 
btSwapEndian(
bvh->m_SubtreeHeaders[i].m_quantizedAabbMin[1]);
 
 1097                        bvh->m_SubtreeHeaders[i].m_quantizedAabbMin[2] = 
btSwapEndian(
bvh->m_SubtreeHeaders[i].m_quantizedAabbMin[2]);
 
 1099                        bvh->m_SubtreeHeaders[i].m_quantizedAabbMax[0] = 
btSwapEndian(
bvh->m_SubtreeHeaders[i].m_quantizedAabbMax[0]);
 
 1100                        bvh->m_SubtreeHeaders[i].m_quantizedAabbMax[1] = 
btSwapEndian(
bvh->m_SubtreeHeaders[i].m_quantizedAabbMax[1]);
 
 1101                        bvh->m_SubtreeHeaders[i].m_quantizedAabbMax[2] = 
btSwapEndian(
bvh->m_SubtreeHeaders[i].m_quantizedAabbMax[2]);
 
 1103                        bvh->m_SubtreeHeaders[i].m_rootNodeIndex = 
static_cast<int>(
btSwapEndian(
bvh->m_SubtreeHeaders[i].m_rootNodeIndex));
 
 1104                        bvh->m_SubtreeHeaders[i].m_subtreeSize = 
static_cast<int>(
btSwapEndian(
bvh->m_SubtreeHeaders[i].m_subtreeSize));
 
 1113                                                                                                                                                          m_bvhAabbMax(
self.m_bvhAabbMax),
 
 1114                                                                                                                                                          m_bvhQuantization(
self.m_bvhQuantization),
 
bool btRayAabb(const btVector3 &rayFrom, const btVector3 &rayTo, const btVector3 &aabbMin, const btVector3 &aabbMax, btScalar ¶m, btVector3 &normal)
 
bool TestAabbAgainstAabb2(const btVector3 &aabbMin1, const btVector3 &aabbMax1, const btVector3 &aabbMin2, const btVector3 &aabbMax2)
conservative test for overlap between two aabbs
 
bool btRayAabb2(const btVector3 &rayFrom, const btVector3 &rayInvDirection, const unsigned int raySign[3], const btVector3 bounds[2], btScalar &tmin, btScalar lambda_min, btScalar lambda_max)
 
unsigned testQuantizedAabbAgainstQuantizedAabb(const unsigned short int *aabbMin1, const unsigned short int *aabbMax1, const unsigned short int *aabbMin2, const unsigned short int *aabbMax2)
 
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
 
const T & btMax(const T &a, const T &b)
 
#define btOptimizedBvhNodeData
 
#define MAX_SUBTREE_SIZE_IN_BYTES
 
#define btQuantizedBvhDataName
 
#define btQuantizedBvhData
 
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
 
unsigned btSwapEndian(unsigned val)
 
#define BT_BULLET_VERSION
 
void btSwapVector3Endian(const btVector3 &sourceVec, btVector3 &destVec)
btSwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization
 
void btUnSwapVector3Endian(btVector3 &vector)
btUnSwapVector3Endian swaps vector endianness, useful for network and cross-platform serialization
 
int size() const
return the number of elements in the array
 
void resize(int newsize, const T &fillData=T())
 
void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0),...
 
T & expand(const T &fillValue=T())
 
void initializeFromBuffer(void *buffer, int size, int capacity)
 
btBvhSubtreeInfo provides info to gather a subtree of limited size
 
void setAabbFromQuantizeNode(const btQuantizedBvhNode &quantizedNode)
 
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations.
 
The btQuantizedBvh class stores an AABB tree that can be quickly traversed on CPU and Cell SPU.
 
void reportAabbOverlappingNodex(btNodeOverlapCallback *nodeCallback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
***************************************** expert/internal use only *************************
 
void setInternalNodeAabbMax(int nodeIndex, const btVector3 &aabbMax)
 
void setQuantizationValues(const btVector3 &bvhAabbMin, const btVector3 &bvhAabbMax, btScalar quantizationMargin=btScalar(1.0))
***************************************** expert/internal use only *************************
 
void swapLeafNodes(int firstIndex, int secondIndex)
 
unsigned calculateSerializeBufferSize() const
 
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
 
void updateSubtreeHeaders(int leftChildNodexIndex, int rightChildNodexIndex)
 
void buildTree(int startIndex, int endIndex)
 
QuantizedNodeArray m_quantizedLeafNodes
 
btTraversalMode m_traversalMode
 
void quantize(unsigned short *out, const btVector3 &point, int isMax) const
 
btVector3 m_bvhQuantization
 
void setInternalNodeEscapeIndex(int nodeIndex, int escapeIndex)
 
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'
 
@ TRAVERSAL_STACKLESS_CACHE_FRIENDLY
 
virtual void deSerializeFloat(struct btQuantizedBvhFloatData &quantizedBvhFloatData)
 
void walkStacklessQuantizedTreeAgainstRay(btNodeOverlapCallback *nodeCallback, const btVector3 &raySource, const btVector3 &rayTarget, const btVector3 &aabbMin, const btVector3 &aabbMax, int startNodeIndex, int endNodeIndex) const
 
BvhSubtreeInfoArray m_SubtreeHeaders
 
NodeArray m_contiguousNodes
 
virtual ~btQuantizedBvh()
 
static unsigned int getAlignmentSerializationPadding()
 
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 walkStacklessQuantizedTreeCacheFriendly(btNodeOverlapCallback *nodeCallback, unsigned short int *quantizedQueryAabbMin, unsigned short int *quantizedQueryAabbMax) const
tree traversal designed for small-memory processors like PS3 SPU
 
void walkStacklessTree(btNodeOverlapCallback *nodeCallback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
 
void walkStacklessTreeAgainstRay(btNodeOverlapCallback *nodeCallback, const btVector3 &raySource, const btVector3 &rayTarget, const btVector3 &aabbMin, const btVector3 &aabbMax, int startNodeIndex, int endNodeIndex) const
 
void setInternalNodeAabbMin(int nodeIndex, const btVector3 &aabbMin)
two versions, one for quantized and normal nodes.
 
void mergeInternalNodeAabb(int nodeIndex, const btVector3 &newAabbMin, const btVector3 &newAabbMax)
 
void walkStacklessQuantizedTree(btNodeOverlapCallback *nodeCallback, unsigned short int *quantizedQueryAabbMin, unsigned short int *quantizedQueryAabbMax, int startNodeIndex, int endNodeIndex) const
 
void quantizeWithClamp(unsigned short *out, const btVector3 &point2, int isMax) const
 
void assignInternalNodeFromLeafNode(int internalNode, int leafNodeIndex)
 
int sortAndCalcSplittingIndex(int startIndex, int endIndex, int splitAxis)
 
btVector3 getAabbMax(int nodeIndex) const
 
btVector3 getAabbMin(int nodeIndex) const
 
int calcSplittingAxis(int startIndex, int endIndex)
 
QuantizedNodeArray m_quantizedContiguousNodes
 
void buildInternal()
buildInternal is expert use only: assumes that setQuantizationValues and LeafNodeArray are initialize...
 
btVector3 unQuantize(const unsigned short *vecIn) const
 
virtual bool serialize(void *o_alignedDataBuffer, unsigned i_dataBufferSize, bool i_swapEndian) const
Data buffer MUST be 16 byte aligned.
 
virtual void deSerializeDouble(struct btQuantizedBvhDoubleData &quantizedBvhDoubleData)
 
btVector3 can be used to represent 3D points and vectors.
 
void setMax(const btVector3 &other)
Set each element to the max of the current values and the values of another btVector3.
 
btVector3 & safeNormalize()
 
btScalar dot(const btVector3 &v) const
Return the dot product.
 
void deSerializeFloat(const struct btVector3FloatData &dataIn)
 
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
 
void deSerializeDouble(const struct btVector3DoubleData &dataIn)
 
int maxAxis() const
Return the axis with the largest value Note return values are 0,1,2 for x, y, or z.
 
void serialize(struct btVector3Data &dataOut) const
 
void setMin(const btVector3 &other)
Set each element to the min of the current values and the values of another btVector3.
 
btOptimizedBvhNode contains both internal and leaf node information.
 
btQuantizedBvhNode is a compressed aabb node, 16 bytes.