Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Update a leaf in in TLAS and all its parent to the root.
- * The index of the leaf (that is NOT the index of the internal node) is also the index of the associated BLAS.
- *
- * @param indexOfLeafInTLAS the index of the BLAS leaf that has to be updated
- */
- void updateTLASLeaf(const uint indexOfLeafInTLAS) {
- uint indexOfLastUpdatedNodeInTLAS = ((1 << expOfTwo_maxModels) - 1) + indexOfLeafInTLAS;
- tlas.tree[indexOfLastUpdatedNodeInTLAS].aabb = transformAABB(tlasBLAS[indexOfLeafInTLAS].tree[0].aabb, tlasBLAS[indexOfLeafInTLAS].ModelMatrix);
- while (!isRootNode(indexOfLastUpdatedNodeInTLAS)) {
- memoryBarrier();
- // Target the parent node for update
- indexOfLastUpdatedNodeInTLAS = parentNode(indexOfLastUpdatedNodeInTLAS);
- // Update the current node
- tlas.tree[indexOfLastUpdatedNodeInTLAS].aabb = joinAABBs(
- tlas.tree[leftNode(indexOfLastUpdatedNodeInTLAS)].aabb,
- tlas.tree[rightNode(indexOfLastUpdatedNodeInTLAS)].aabb);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment