three-mesh-bvh
Advanced tools
Comparing version 0.7.2 to 0.7.3
{ | ||
"name": "three-mesh-bvh", | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"description": "A BVH implementation to speed up raycasting against three.js meshes.", | ||
@@ -5,0 +5,0 @@ "module": "src/index.js", |
@@ -9,3 +9,3 @@ import { BYTES_PER_NODE, IS_LEAFNODE_FLAG } from '../Constants.js'; | ||
if ( node.count ) { | ||
if ( 'count' in node ) { | ||
@@ -41,3 +41,3 @@ return 1; | ||
const stride2Offset = byteOffset / 2; | ||
const isLeaf = ! ! node.count; | ||
const isLeaf = 'count' in node; | ||
const boundingData = node.boundingData; | ||
@@ -44,0 +44,0 @@ for ( let i = 0; i < 6; i ++ ) { |
@@ -221,3 +221,3 @@ import { | ||
// copy the data over to the new texture array | ||
const dimension = Math.ceil( Math.sqrt( count ) ); | ||
const dimension = Math.ceil( Math.sqrt( count ) ) || 1; | ||
const length = finalStride * dimension * dimension; | ||
@@ -224,0 +224,0 @@ const dataArray = new targetBufferCons( length ); |
@@ -545,4 +545,28 @@ import { BufferAttribute, BufferGeometry, Vector3, Vector4, Matrix4, Matrix3 } from 'three'; | ||
mergeBufferGeometries( _intermediateGeometry, { useGroups, skipAttributes }, targetGeometry ); | ||
if ( _intermediateGeometry.length === 0 ) { | ||
// if there are no geometries then just create a fake empty geometry to provide | ||
targetGeometry.setIndex( null ); | ||
// remove all geometry | ||
const attrs = targetGeometry.attributes; | ||
for ( const key in attrs ) { | ||
targetGeometry.deleteAttribute( key ); | ||
} | ||
// create dummy attributes | ||
for ( const key in this.attributes ) { | ||
targetGeometry.setAttribute( this.attributes[ key ], new BufferAttribute( new Float32Array( 0 ), 4, false ) ); | ||
} | ||
} else { | ||
mergeBufferGeometries( _intermediateGeometry, { useGroups, skipAttributes }, targetGeometry ); | ||
} | ||
for ( const key in targetGeometry.attributes ) { | ||
@@ -549,0 +573,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1533065
17472