Browse Source

Updated builds.

Mugen87 2 years ago
parent
commit
7ef102e30e
4 changed files with 189 additions and 0 deletions
  1. 63 0
      build/three.cjs
  2. 63 0
      build/three.js
  3. 0 0
      build/three.min.js
  4. 63 0
      build/three.module.js

+ 63 - 0
build/three.cjs

@@ -30707,6 +30707,7 @@ const _skinWeight = /*@__PURE__*/ new Vector4();
 
 const _vector3 = /*@__PURE__*/ new Vector3();
 const _matrix4 = /*@__PURE__*/ new Matrix4();
+const _vertex = /*@__PURE__*/ new Vector3();
 
 class SkinnedMesh extends Mesh {
 
@@ -30722,6 +30723,57 @@ class SkinnedMesh extends Mesh {
 		this.bindMatrix = new Matrix4();
 		this.bindMatrixInverse = new Matrix4();
 
+		this.boundingBox = null;
+		this.boundingSphere = null;
+
+	}
+
+	computeBoundingBox() {
+
+		const geometry = this.geometry;
+
+		if ( this.boundingBox === null ) {
+
+			this.boundingBox = new Box3();
+
+		}
+
+		this.boundingBox.makeEmpty();
+
+		const positionAttribute = geometry.getAttribute( 'position' );
+
+		for ( let i = 0; i < positionAttribute.count; i ++ ) {
+
+			_vertex.fromBufferAttribute( positionAttribute, i );
+			this.applyBoneTransform( i, _vertex );
+			this.boundingBox.expandByPoint( _vertex );
+
+		}
+
+	}
+
+	computeBoundingSphere() {
+
+		const geometry = this.geometry;
+
+		if ( this.boundingSphere === null ) {
+
+			this.boundingSphere = new Sphere();
+
+		}
+
+		this.boundingSphere.makeEmpty();
+
+		const positionAttribute = geometry.getAttribute( 'position' );
+
+		for ( let i = 0; i < positionAttribute.count; i ++ ) {
+
+			_vertex.fromBufferAttribute( positionAttribute, i );
+			this.applyBoneTransform( i, _vertex );
+			this.boundingSphere.expandByPoint( _vertex );
+
+		}
+
 	}
 
 	copy( source, recursive ) {
@@ -31326,6 +31378,17 @@ class InstancedMesh extends Mesh {
 
 		if ( _mesh.material === undefined ) return;
 
+		// test with bounding sphere first
+
+		if ( this.boundingSphere === null ) this.computeBoundingSphere();
+
+		_sphere$2.copy( this.boundingSphere );
+		_sphere$2.applyMatrix4( matrixWorld );
+
+		if ( raycaster.ray.intersectsSphere( _sphere$2 ) === false ) return;
+
+		// now test each instance
+
 		for ( let instanceId = 0; instanceId < raycastTimes; instanceId ++ ) {
 
 			// calculate the world matrix for each instance

+ 63 - 0
build/three.js

@@ -30712,6 +30712,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
 
 	const _vector3 = /*@__PURE__*/ new Vector3();
 	const _matrix4 = /*@__PURE__*/ new Matrix4();
+	const _vertex = /*@__PURE__*/ new Vector3();
 
 	class SkinnedMesh extends Mesh {
 
@@ -30727,6 +30728,57 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
 			this.bindMatrix = new Matrix4();
 			this.bindMatrixInverse = new Matrix4();
 
+			this.boundingBox = null;
+			this.boundingSphere = null;
+
+		}
+
+		computeBoundingBox() {
+
+			const geometry = this.geometry;
+
+			if ( this.boundingBox === null ) {
+
+				this.boundingBox = new Box3();
+
+			}
+
+			this.boundingBox.makeEmpty();
+
+			const positionAttribute = geometry.getAttribute( 'position' );
+
+			for ( let i = 0; i < positionAttribute.count; i ++ ) {
+
+				_vertex.fromBufferAttribute( positionAttribute, i );
+				this.applyBoneTransform( i, _vertex );
+				this.boundingBox.expandByPoint( _vertex );
+
+			}
+
+		}
+
+		computeBoundingSphere() {
+
+			const geometry = this.geometry;
+
+			if ( this.boundingSphere === null ) {
+
+				this.boundingSphere = new Sphere();
+
+			}
+
+			this.boundingSphere.makeEmpty();
+
+			const positionAttribute = geometry.getAttribute( 'position' );
+
+			for ( let i = 0; i < positionAttribute.count; i ++ ) {
+
+				_vertex.fromBufferAttribute( positionAttribute, i );
+				this.applyBoneTransform( i, _vertex );
+				this.boundingSphere.expandByPoint( _vertex );
+
+			}
+
 		}
 
 		copy( source, recursive ) {
@@ -31331,6 +31383,17 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
 
 			if ( _mesh.material === undefined ) return;
 
+			// test with bounding sphere first
+
+			if ( this.boundingSphere === null ) this.computeBoundingSphere();
+
+			_sphere$2.copy( this.boundingSphere );
+			_sphere$2.applyMatrix4( matrixWorld );
+
+			if ( raycaster.ray.intersectsSphere( _sphere$2 ) === false ) return;
+
+			// now test each instance
+
 			for ( let instanceId = 0; instanceId < raycastTimes; instanceId ++ ) {
 
 				// calculate the world matrix for each instance

File diff suppressed because it is too large
+ 0 - 0
build/three.min.js


+ 63 - 0
build/three.module.js

@@ -30705,6 +30705,7 @@ const _skinWeight = /*@__PURE__*/ new Vector4();
 
 const _vector3 = /*@__PURE__*/ new Vector3();
 const _matrix4 = /*@__PURE__*/ new Matrix4();
+const _vertex = /*@__PURE__*/ new Vector3();
 
 class SkinnedMesh extends Mesh {
 
@@ -30720,6 +30721,57 @@ class SkinnedMesh extends Mesh {
 		this.bindMatrix = new Matrix4();
 		this.bindMatrixInverse = new Matrix4();
 
+		this.boundingBox = null;
+		this.boundingSphere = null;
+
+	}
+
+	computeBoundingBox() {
+
+		const geometry = this.geometry;
+
+		if ( this.boundingBox === null ) {
+
+			this.boundingBox = new Box3();
+
+		}
+
+		this.boundingBox.makeEmpty();
+
+		const positionAttribute = geometry.getAttribute( 'position' );
+
+		for ( let i = 0; i < positionAttribute.count; i ++ ) {
+
+			_vertex.fromBufferAttribute( positionAttribute, i );
+			this.applyBoneTransform( i, _vertex );
+			this.boundingBox.expandByPoint( _vertex );
+
+		}
+
+	}
+
+	computeBoundingSphere() {
+
+		const geometry = this.geometry;
+
+		if ( this.boundingSphere === null ) {
+
+			this.boundingSphere = new Sphere();
+
+		}
+
+		this.boundingSphere.makeEmpty();
+
+		const positionAttribute = geometry.getAttribute( 'position' );
+
+		for ( let i = 0; i < positionAttribute.count; i ++ ) {
+
+			_vertex.fromBufferAttribute( positionAttribute, i );
+			this.applyBoneTransform( i, _vertex );
+			this.boundingSphere.expandByPoint( _vertex );
+
+		}
+
 	}
 
 	copy( source, recursive ) {
@@ -31324,6 +31376,17 @@ class InstancedMesh extends Mesh {
 
 		if ( _mesh.material === undefined ) return;
 
+		// test with bounding sphere first
+
+		if ( this.boundingSphere === null ) this.computeBoundingSphere();
+
+		_sphere$2.copy( this.boundingSphere );
+		_sphere$2.applyMatrix4( matrixWorld );
+
+		if ( raycaster.ray.intersectsSphere( _sphere$2 ) === false ) return;
+
+		// now test each instance
+
 		for ( let instanceId = 0; instanceId < raycastTimes; instanceId ++ ) {
 
 			// calculate the world matrix for each instance

Some files were not shown because too many files changed in this diff