////////////////////////////////////////////////////////////////////
| 101 | |
| 102 | ///////////////////////////////////////////////////////////////////////// |
| 103 | PxU32 RTree::computeBottomLevelCount(PxU32 multiplier) const |
| 104 | { |
| 105 | PxU32 topCount = 0, curCount = mNumRootPages; |
| 106 | const RTreePage* rightMostPage = &mPages[mNumRootPages-1]; |
| 107 | PX_ASSERT(rightMostPage); |
| 108 | for (PxU32 level = 0; level < mNumLevels-1; level++) |
| 109 | { |
| 110 | topCount += curCount; |
| 111 | PxU32 nc = rightMostPage->nodeCount(); |
| 112 | PX_ASSERT(nc > 0 && nc <= RTREE_N); |
| 113 | // old version pointer, up to PX_MESH_VERSION 8 |
| 114 | PxU32 ptr = (rightMostPage->ptrs[nc-1]) * multiplier; |
| 115 | PX_ASSERT(ptr % sizeof(RTreePage) == 0); |
| 116 | const RTreePage* rightMostPageNext = mPages + (ptr / sizeof(RTreePage)); |
| 117 | curCount = PxU32(rightMostPageNext - rightMostPage); |
| 118 | rightMostPage = rightMostPageNext; |
| 119 | } |
| 120 | |
| 121 | return mTotalPages - topCount; |
| 122 | } |
| 123 | |
| 124 | ///////////////////////////////////////////////////////////////////////// |
| 125 | RTree::RTree(const PxEMPTY) |