Explorar el Código

Updated builds.

Mr.doob hace 2 años
padre
commit
5a332781e2
Se han modificado 4 ficheros con 80 adiciones y 101 borrados
  1. 26 33
      build/three.cjs
  2. 26 33
      build/three.js
  3. 0 0
      build/three.min.js
  4. 28 35
      build/three.module.js

+ 26 - 33
build/three.cjs

@@ -7,7 +7,7 @@
 
 Object.defineProperty(exports, '__esModule', { value: true });
 
-const REVISION = '145';
+const REVISION = '146dev';
 const MOUSE = {
 	LEFT: 0,
 	MIDDLE: 1,
@@ -4055,28 +4055,28 @@ class Box3 {
 
 		_v1$7.subVectors(triangle.b, _center);
 
-		_v2$3.subVectors(triangle.c, _center); // compute edge vectors for triangle
+		_v2$4.subVectors(triangle.c, _center); // compute edge vectors for triangle
 
 
 		_f0.subVectors(_v1$7, _v0$2);
 
-		_f1.subVectors(_v2$3, _v1$7);
+		_f1.subVectors(_v2$4, _v1$7);
 
-		_f2.subVectors(_v0$2, _v2$3); // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb
+		_f2.subVectors(_v0$2, _v2$4); // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb
 		// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation
 		// axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)
 
 
 		let axes = [0, -_f0.z, _f0.y, 0, -_f1.z, _f1.y, 0, -_f2.z, _f2.y, _f0.z, 0, -_f0.x, _f1.z, 0, -_f1.x, _f2.z, 0, -_f2.x, -_f0.y, _f0.x, 0, -_f1.y, _f1.x, 0, -_f2.y, _f2.x, 0];
 
-		if (!satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents)) {
+		if (!satForAxes(axes, _v0$2, _v1$7, _v2$4, _extents)) {
 			return false;
 		} // test 3 face normals from the aabb
 
 
 		axes = [1, 0, 0, 0, 1, 0, 0, 0, 1];
 
-		if (!satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents)) {
+		if (!satForAxes(axes, _v0$2, _v1$7, _v2$4, _extents)) {
 			return false;
 		} // finally testing the face normal of the triangle
 		// use already existing triangle edge vectors here
@@ -4085,7 +4085,7 @@ class Box3 {
 		_triangleNormal.crossVectors(_f0, _f1);
 
 		axes = [_triangleNormal.x, _triangleNormal.y, _triangleNormal.z];
-		return satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents);
+		return satForAxes(axes, _v0$2, _v1$7, _v2$4, _extents);
 	}
 
 	clampPoint(point, target) {
@@ -4173,7 +4173,7 @@ const _v0$2 = /*@__PURE__*/new Vector3();
 
 const _v1$7 = /*@__PURE__*/new Vector3();
 
-const _v2$3 = /*@__PURE__*/new Vector3(); // triangle edge vectors
+const _v2$4 = /*@__PURE__*/new Vector3(); // triangle edge vectors
 
 
 const _f0 = /*@__PURE__*/new Vector3();
@@ -4215,9 +4215,7 @@ const _box$2 = /*@__PURE__*/new Box3();
 
 const _v1$6 = /*@__PURE__*/new Vector3();
 
-const _toFarthestPoint = /*@__PURE__*/new Vector3();
-
-const _toPoint = /*@__PURE__*/new Vector3();
+const _v2$3 = /*@__PURE__*/new Vector3();
 
 class Sphere {
 	constructor(center = new Vector3(), radius = -1) {
@@ -4327,47 +4325,42 @@ class Sphere {
 			this.center.copy(point);
 			this.radius = 0;
 			return this;
-		} // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L649-L671
-
+		}
 
-		_toPoint.subVectors(point, this.center);
+		_v1$6.subVectors(point, this.center);
 
-		const lengthSq = _toPoint.lengthSq();
+		const lengthSq = _v1$6.lengthSq();
 
 		if (lengthSq > this.radius * this.radius) {
+			// calculate the minimal sphere
 			const length = Math.sqrt(lengthSq);
-			const missingRadiusHalf = (length - this.radius) * 0.5; // Nudge this sphere towards the target point. Add half the missing distance to radius,
-			// and the other half to position. This gives a tighter enclosure, instead of if
-			// the whole missing distance were just added to radius.
-
-			this.center.add(_toPoint.multiplyScalar(missingRadiusHalf / length));
-			this.radius += missingRadiusHalf;
+			const delta = (length - this.radius) * 0.5;
+			this.center.addScaledVector(_v1$6, delta / length);
+			this.radius += delta;
 		}
 
 		return this;
 	}
 
 	union(sphere) {
-		// handle empty sphere cases
 		if (sphere.isEmpty()) {
 			return this;
-		} else if (this.isEmpty()) {
+		}
+
+		if (this.isEmpty()) {
 			this.copy(sphere);
 			return this;
-		} // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L759-L769
-		// To enclose another sphere into this sphere, we only need to enclose two points:
-		// 1) Enclose the farthest point on the other sphere into this sphere.
-		// 2) Enclose the opposite point of the farthest point into this sphere.
-
+		}
 
 		if (this.center.equals(sphere.center) === true) {
-			_toFarthestPoint.set(0, 0, 1).multiplyScalar(sphere.radius);
+			this.radius = Math.max(this.radius, sphere.radius);
 		} else {
-			_toFarthestPoint.subVectors(sphere.center, this.center).normalize().multiplyScalar(sphere.radius);
+			_v2$3.subVectors(sphere.center, this.center).setLength(sphere.radius);
+
+			this.expandByPoint(_v1$6.copy(sphere.center).add(_v2$3));
+			this.expandByPoint(_v1$6.copy(sphere.center).sub(_v2$3));
 		}
 
-		this.expandByPoint(_v1$6.copy(sphere.center).add(_toFarthestPoint));
-		this.expandByPoint(_v1$6.copy(sphere.center).sub(_toFarthestPoint));
 		return this;
 	}
 
@@ -16515,7 +16508,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
 	const maxTextureSize = capabilities.maxTextureSize;
 	const maxSamples = capabilities.maxSamples;
 	const multisampledRTTExt = extensions.has('WEBGL_multisampled_render_to_texture') ? extensions.get('WEBGL_multisampled_render_to_texture') : null;
-	const supportsInvalidateFramebuffer = /OculusBrowser/g.test(navigator.userAgent);
+	const supportsInvalidateFramebuffer = /OculusBrowser/g.test(typeof navigator === 'undefined' ? '' : navigator.userAgent);
 
 	const _videoTextures = new WeakMap();
 

+ 26 - 33
build/three.js

@@ -9,7 +9,7 @@
 	(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.THREE = {}));
 })(this, (function (exports) { 'use strict';
 
-	const REVISION = '145';
+	const REVISION = '146dev';
 	const MOUSE = {
 		LEFT: 0,
 		MIDDLE: 1,
@@ -4057,28 +4057,28 @@
 
 			_v1$7.subVectors(triangle.b, _center);
 
-			_v2$3.subVectors(triangle.c, _center); // compute edge vectors for triangle
+			_v2$4.subVectors(triangle.c, _center); // compute edge vectors for triangle
 
 
 			_f0.subVectors(_v1$7, _v0$2);
 
-			_f1.subVectors(_v2$3, _v1$7);
+			_f1.subVectors(_v2$4, _v1$7);
 
-			_f2.subVectors(_v0$2, _v2$3); // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb
+			_f2.subVectors(_v0$2, _v2$4); // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb
 			// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation
 			// axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)
 
 
 			let axes = [0, -_f0.z, _f0.y, 0, -_f1.z, _f1.y, 0, -_f2.z, _f2.y, _f0.z, 0, -_f0.x, _f1.z, 0, -_f1.x, _f2.z, 0, -_f2.x, -_f0.y, _f0.x, 0, -_f1.y, _f1.x, 0, -_f2.y, _f2.x, 0];
 
-			if (!satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents)) {
+			if (!satForAxes(axes, _v0$2, _v1$7, _v2$4, _extents)) {
 				return false;
 			} // test 3 face normals from the aabb
 
 
 			axes = [1, 0, 0, 0, 1, 0, 0, 0, 1];
 
-			if (!satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents)) {
+			if (!satForAxes(axes, _v0$2, _v1$7, _v2$4, _extents)) {
 				return false;
 			} // finally testing the face normal of the triangle
 			// use already existing triangle edge vectors here
@@ -4087,7 +4087,7 @@
 			_triangleNormal.crossVectors(_f0, _f1);
 
 			axes = [_triangleNormal.x, _triangleNormal.y, _triangleNormal.z];
-			return satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents);
+			return satForAxes(axes, _v0$2, _v1$7, _v2$4, _extents);
 		}
 
 		clampPoint(point, target) {
@@ -4175,7 +4175,7 @@
 
 	const _v1$7 = /*@__PURE__*/new Vector3();
 
-	const _v2$3 = /*@__PURE__*/new Vector3(); // triangle edge vectors
+	const _v2$4 = /*@__PURE__*/new Vector3(); // triangle edge vectors
 
 
 	const _f0 = /*@__PURE__*/new Vector3();
@@ -4217,9 +4217,7 @@
 
 	const _v1$6 = /*@__PURE__*/new Vector3();
 
-	const _toFarthestPoint = /*@__PURE__*/new Vector3();
-
-	const _toPoint = /*@__PURE__*/new Vector3();
+	const _v2$3 = /*@__PURE__*/new Vector3();
 
 	class Sphere {
 		constructor(center = new Vector3(), radius = -1) {
@@ -4329,47 +4327,42 @@
 				this.center.copy(point);
 				this.radius = 0;
 				return this;
-			} // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L649-L671
-
+			}
 
-			_toPoint.subVectors(point, this.center);
+			_v1$6.subVectors(point, this.center);
 
-			const lengthSq = _toPoint.lengthSq();
+			const lengthSq = _v1$6.lengthSq();
 
 			if (lengthSq > this.radius * this.radius) {
+				// calculate the minimal sphere
 				const length = Math.sqrt(lengthSq);
-				const missingRadiusHalf = (length - this.radius) * 0.5; // Nudge this sphere towards the target point. Add half the missing distance to radius,
-				// and the other half to position. This gives a tighter enclosure, instead of if
-				// the whole missing distance were just added to radius.
-
-				this.center.add(_toPoint.multiplyScalar(missingRadiusHalf / length));
-				this.radius += missingRadiusHalf;
+				const delta = (length - this.radius) * 0.5;
+				this.center.addScaledVector(_v1$6, delta / length);
+				this.radius += delta;
 			}
 
 			return this;
 		}
 
 		union(sphere) {
-			// handle empty sphere cases
 			if (sphere.isEmpty()) {
 				return this;
-			} else if (this.isEmpty()) {
+			}
+
+			if (this.isEmpty()) {
 				this.copy(sphere);
 				return this;
-			} // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L759-L769
-			// To enclose another sphere into this sphere, we only need to enclose two points:
-			// 1) Enclose the farthest point on the other sphere into this sphere.
-			// 2) Enclose the opposite point of the farthest point into this sphere.
-
+			}
 
 			if (this.center.equals(sphere.center) === true) {
-				_toFarthestPoint.set(0, 0, 1).multiplyScalar(sphere.radius);
+				this.radius = Math.max(this.radius, sphere.radius);
 			} else {
-				_toFarthestPoint.subVectors(sphere.center, this.center).normalize().multiplyScalar(sphere.radius);
+				_v2$3.subVectors(sphere.center, this.center).setLength(sphere.radius);
+
+				this.expandByPoint(_v1$6.copy(sphere.center).add(_v2$3));
+				this.expandByPoint(_v1$6.copy(sphere.center).sub(_v2$3));
 			}
 
-			this.expandByPoint(_v1$6.copy(sphere.center).add(_toFarthestPoint));
-			this.expandByPoint(_v1$6.copy(sphere.center).sub(_toFarthestPoint));
 			return this;
 		}
 
@@ -16517,7 +16510,7 @@
 		const maxTextureSize = capabilities.maxTextureSize;
 		const maxSamples = capabilities.maxSamples;
 		const multisampledRTTExt = extensions.has('WEBGL_multisampled_render_to_texture') ? extensions.get('WEBGL_multisampled_render_to_texture') : null;
-		const supportsInvalidateFramebuffer = /OculusBrowser/g.test(navigator.userAgent);
+		const supportsInvalidateFramebuffer = /OculusBrowser/g.test(typeof navigator === 'undefined' ? '' : navigator.userAgent);
 
 		const _videoTextures = new WeakMap();
 

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
build/three.min.js


+ 28 - 35
build/three.module.js

@@ -3,7 +3,7 @@
  * Copyright 2010-2022 Three.js Authors
  * SPDX-License-Identifier: MIT
  */
-const REVISION = '145';
+const REVISION = '146dev';
 const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
 const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
 const CullFaceNone = 0;
@@ -5282,12 +5282,12 @@ class Box3 {
 		// translate triangle to aabb origin
 		_v0$2.subVectors( triangle.a, _center );
 		_v1$7.subVectors( triangle.b, _center );
-		_v2$3.subVectors( triangle.c, _center );
+		_v2$4.subVectors( triangle.c, _center );
 
 		// compute edge vectors for triangle
 		_f0.subVectors( _v1$7, _v0$2 );
-		_f1.subVectors( _v2$3, _v1$7 );
-		_f2.subVectors( _v0$2, _v2$3 );
+		_f1.subVectors( _v2$4, _v1$7 );
+		_f2.subVectors( _v0$2, _v2$4 );
 
 		// test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb
 		// make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation
@@ -5297,7 +5297,7 @@ class Box3 {
 			_f0.z, 0, - _f0.x, _f1.z, 0, - _f1.x, _f2.z, 0, - _f2.x,
 			- _f0.y, _f0.x, 0, - _f1.y, _f1.x, 0, - _f2.y, _f2.x, 0
 		];
-		if ( ! satForAxes( axes, _v0$2, _v1$7, _v2$3, _extents ) ) {
+		if ( ! satForAxes( axes, _v0$2, _v1$7, _v2$4, _extents ) ) {
 
 			return false;
 
@@ -5305,7 +5305,7 @@ class Box3 {
 
 		// test 3 face normals from the aabb
 		axes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ];
-		if ( ! satForAxes( axes, _v0$2, _v1$7, _v2$3, _extents ) ) {
+		if ( ! satForAxes( axes, _v0$2, _v1$7, _v2$4, _extents ) ) {
 
 			return false;
 
@@ -5316,7 +5316,7 @@ class Box3 {
 		_triangleNormal.crossVectors( _f0, _f1 );
 		axes = [ _triangleNormal.x, _triangleNormal.y, _triangleNormal.z ];
 
-		return satForAxes( axes, _v0$2, _v1$7, _v2$3, _extents );
+		return satForAxes( axes, _v0$2, _v1$7, _v2$4, _extents );
 
 	}
 
@@ -5422,7 +5422,7 @@ const _box$3 = /*@__PURE__*/ new Box3();
 
 const _v0$2 = /*@__PURE__*/ new Vector3();
 const _v1$7 = /*@__PURE__*/ new Vector3();
-const _v2$3 = /*@__PURE__*/ new Vector3();
+const _v2$4 = /*@__PURE__*/ new Vector3();
 
 // triangle edge vectors
 
@@ -5463,8 +5463,7 @@ function satForAxes( axes, v0, v1, v2, extents ) {
 
 const _box$2 = /*@__PURE__*/ new Box3();
 const _v1$6 = /*@__PURE__*/ new Vector3();
-const _toFarthestPoint = /*@__PURE__*/ new Vector3();
-const _toPoint = /*@__PURE__*/ new Vector3();
+const _v2$3 = /*@__PURE__*/ new Vector3();
 
 class Sphere {
 
@@ -5624,29 +5623,28 @@ class Sphere {
 		if ( this.isEmpty() ) {
 
 			this.center.copy( point );
+
 			this.radius = 0;
 
 			return this;
 
 		}
 
-		// from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L649-L671
-
-		_toPoint.subVectors( point, this.center );
+		_v1$6.subVectors( point, this.center );
 
-		const lengthSq = _toPoint.lengthSq();
+		const lengthSq = _v1$6.lengthSq();
 
 		if ( lengthSq > ( this.radius * this.radius ) ) {
 
+			// calculate the minimal sphere
+
 			const length = Math.sqrt( lengthSq );
-			const missingRadiusHalf = ( length - this.radius ) * 0.5;
 
-			// Nudge this sphere towards the target point. Add half the missing distance to radius,
-			// and the other half to position. This gives a tighter enclosure, instead of if
-			// the whole missing distance were just added to radius.
+			const delta = ( length - this.radius ) * 0.5;
+
+			this.center.addScaledVector( _v1$6, delta / length );
 
-			this.center.add( _toPoint.multiplyScalar( missingRadiusHalf / length ) );
-			this.radius += missingRadiusHalf;
+			this.radius += delta;
 
 		}
 
@@ -5656,12 +5654,13 @@ class Sphere {
 
 	union( sphere ) {
 
-		// handle empty sphere cases
 		if ( sphere.isEmpty() ) {
 
 			return this;
 
-		} else if ( this.isEmpty() ) {
+		}
+
+		if ( this.isEmpty() ) {
 
 			this.copy( sphere );
 
@@ -5669,26 +5668,20 @@ class Sphere {
 
 		}
 
-		// from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L759-L769
-
-		// To enclose another sphere into this sphere, we only need to enclose two points:
-		// 1) Enclose the farthest point on the other sphere into this sphere.
-		// 2) Enclose the opposite point of the farthest point into this sphere.
+		if ( this.center.equals( sphere.center ) === true ) {
 
-		 if ( this.center.equals( sphere.center ) === true ) {
+			 this.radius = Math.max( this.radius, sphere.radius );
 
-			 _toFarthestPoint.set( 0, 0, 1 ).multiplyScalar( sphere.radius );
+		} else {
 
+			_v2$3.subVectors( sphere.center, this.center ).setLength( sphere.radius );
 
-		} else {
+			this.expandByPoint( _v1$6.copy( sphere.center ).add( _v2$3 ) );
 
-			_toFarthestPoint.subVectors( sphere.center, this.center ).normalize().multiplyScalar( sphere.radius );
+			this.expandByPoint( _v1$6.copy( sphere.center ).sub( _v2$3 ) );
 
 		}
 
-		this.expandByPoint( _v1$6.copy( sphere.center ).add( _toFarthestPoint ) );
-		this.expandByPoint( _v1$6.copy( sphere.center ).sub( _toFarthestPoint ) );
-
 		return this;
 
 	}
@@ -22259,7 +22252,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 	const maxTextureSize = capabilities.maxTextureSize;
 	const maxSamples = capabilities.maxSamples;
 	const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
-	const supportsInvalidateFramebuffer = /OculusBrowser/g.test( navigator.userAgent );
+	const supportsInvalidateFramebuffer = /OculusBrowser/g.test( typeof navigator === 'undefined' ? '' : navigator.userAgent );
 
 	const _videoTextures = new WeakMap();
 	let _canvas;

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio