Skip to content

Commit

Permalink
clean up shepecast file
Browse files Browse the repository at this point in the history
  • Loading branch information
gkjohnson committed Aug 19, 2023
1 parent dd27b02 commit 0147140
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/core/cast/shapecast.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,16 @@ const boxPool = new PrimitivePool( () => new Box3() );

export function shapecast( bvh, root, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset ) {

BufferStack.setBuffer( bvh._roots[ root ] );
const result = _shapecast( 0, bvh.geometry, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset );
BufferStack.clearBuffer();

return result;

}

function _shapecast( ...args ) {

// setup
_box1 = boxPool.getPrimitive();
_box2 = boxPool.getPrimitive();
boxStack.push( _box1, _box2 );
BufferStack.setBuffer( bvh._roots[ root ] );

const result = shapecastTraverse( ...args );
const result = shapecastTraverse( 0, bvh.geometry, intersectsBounds, intersectsRange, boundsTraverseOrder, byteOffset );

// cleanup
BufferStack.clearBuffer();
boxPool.releasePrimitive( _box1 );
boxPool.releasePrimitive( _box2 );
boxStack.pop();
Expand Down

0 comments on commit 0147140

Please sign in to comment.