Clear all the nodes and reset the tree
| 76 | |
| 77 | // Clear all the nodes and reset the tree |
| 78 | void DynamicAABBTree::reset() { |
| 79 | |
| 80 | // Call the destructor of all the nodes |
| 81 | for (int32 i=0; i < mNbAllocatedNodes; i++) { |
| 82 | mNodes[i].~TreeNode(); |
| 83 | } |
| 84 | |
| 85 | // Free the allocated memory for the nodes |
| 86 | mAllocator.release(mNodes, static_cast<size_t>(mNbAllocatedNodes) * sizeof(TreeNode)); |
| 87 | |
| 88 | // Initialize the tree |
| 89 | init(); |
| 90 | } |
| 91 | |
| 92 | // Allocate and return a new node in the tree |
| 93 | int32 DynamicAABBTree::allocateNode() { |