Skip to content

Commit

Permalink
Add support for BatchedMesh in r170
Browse files Browse the repository at this point in the history
  • Loading branch information
gkjohnson committed Nov 9, 2024
1 parent aa800ca commit e220f9d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils/ExtensionUtilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const origBatchedRaycastFunc = BatchedMesh.prototype.raycast;
const _worldScale = /* @__PURE__ */ new Vector3();
const _mesh = /* @__PURE__ */ new Mesh();
const _batchIntersects = [];
const _drawRangeInfo = {};

export function acceleratedRaycast( raycaster, intersects ) {

Expand Down Expand Up @@ -68,7 +69,8 @@ function acceleratedBatchedMeshRaycast( raycaster, intersects ) {
this.getBoundingBoxAt( geometryId, _mesh.geometry.boundingBox );
this.getBoundingSphereAt( geometryId, _mesh.geometry.boundingSphere );

const drawRange = drawRanges[ geometryId ];
// TODO: remove use of drawRanges when r170 is minimum version
const drawRange = drawRanges ? drawRanges[ geometryId ] : this.getGeometryRangeAt( geometryId, _drawRangeInfo );
_mesh.geometry.setDrawRange( drawRange.start, drawRange.count );

}
Expand Down

0 comments on commit e220f9d

Please sign in to comment.