Initialize nodes/indices from the input tree merge data
| 159 | |
| 160 | // Initialize nodes/indices from the input tree merge data |
| 161 | void AABBTree::initTree(const AABBTreeMergeData& tree) |
| 162 | { |
| 163 | PX_ASSERT(mIndices == NULL); |
| 164 | PX_ASSERT(mRuntimePool == NULL); |
| 165 | PX_ASSERT(mParentIndices == NULL); |
| 166 | |
| 167 | // allocate,copy indices |
| 168 | mIndices = reinterpret_cast<PxU32*>(PX_ALLOC(sizeof(PxU32)*tree.mNbIndices, "AABB tree indices")); |
| 169 | mNbIndices = tree.mNbIndices; |
| 170 | PxMemCopy(mIndices, tree.mIndices, sizeof(PxU32)*tree.mNbIndices); |
| 171 | |
| 172 | // allocate,copy nodes |
| 173 | mRuntimePool = PX_NEW(AABBTreeRuntimeNode)[tree.mNbNodes]; |
| 174 | mTotalNbNodes = tree.mNbNodes; |
| 175 | PxMemCopy(mRuntimePool, tree.mNodes, sizeof(AABBTreeRuntimeNode)*tree.mNbNodes); |
| 176 | } |
| 177 | |
| 178 | // Shift indices of the tree by offset. Used for merged trees, when initial indices needs to be shifted to match indices in current pruning pool |
| 179 | void AABBTree::shiftIndices(PxU32 offset) |