Browse Source

Updated builds.

Mr.doob 6 years ago
parent
commit
80cd24c0f2
3 changed files with 454 additions and 447 deletions
  1. 67 64
      build/three.js
  2. 320 319
      build/three.min.js
  3. 67 64
      build/three.module.js

+ 67 - 64
build/three.js

@@ -14656,6 +14656,7 @@
 				boxMesh.material.uniforms.tCube.value = ( background.isWebGLRenderTargetCube ) ? background.texture : background;
 				boxMesh.material.uniforms.tFlip.value = ( background.isWebGLRenderTargetCube ) ? 1 : - 1;
 
+				// push to the pre-sorted opaque render list
 				renderList.push( boxMesh, boxMesh.geometry, boxMesh.material, 0, null );
 
 			} else if ( background && background.isTexture ) {
@@ -14683,6 +14684,7 @@
 
 				planeMesh.material.uniforms.t2D.value = background;
 
+				// push to the pre-sorted opaque render list
 				renderList.push( planeMesh, planeMesh.geometry, planeMesh.material, 0, null );
 
 			}
@@ -21262,72 +21264,73 @@
 
 		constructor: ArrayCamera,
 
-		isArrayCamera: true,
+		isArrayCamera: true
 
-		/**
-		 * Assumes 2 cameras that are perpendicular and share an X-axis, and that
-		 * the cameras' projection and world matrices have already been set.
-		 * And that near and far planes are identical for both cameras.
-		 */
-		setProjectionFromUnion: function () {
-
-			var cameraLPos = new Vector3();
-			var cameraRPos = new Vector3();
-
-			return function () {
-
-				cameraLPos.setFromMatrixPosition( this.cameras[ 0 ].matrixWorld );
-				cameraRPos.setFromMatrixPosition( this.cameras[ 1 ].matrixWorld );
-
-				var ipd = cameraLPos.distanceTo( cameraRPos );
-
-				var projL = this.cameras[ 0 ].projectionMatrix;
-				var projR = this.cameras[ 1 ].projectionMatrix;
-
-				// VR systems will have identical far and near planes, and
-				// most likely identical top and bottom frustum extents.
-				// via: https://computergraphics.stackexchange.com/a/4765
-				var near = projL[ 14 ] / ( projL[ 10 ] - 1 );
-				var far = projL[ 14 ] / ( projL[ 10 ] + 1 );
-
-				var leftFovL = ( projL[ 8 ] - 1 ) / projL[ 0 ];
-				var rightFovR = ( projR[ 8 ] + 1 ) / projR[ 0 ];
-				var leftL = leftFovL * near;
-				var rightR = rightFovR * near;
-				var topL = near * ( projL[ 9 ] + 1 ) / projL[ 5 ];
-				var topR = near * ( projR[ 9 ] + 1 ) / projR[ 5 ];
-				var bottomL = near * ( projL[ 9 ] - 1 ) / projL[ 5 ];
-				var bottomR = near * ( projR[ 9 ] - 1 ) / projR[ 5 ];
-
-				// Calculate the new camera's position offset from the
-				// left camera.
-				var zOffset = ipd / ( leftFovL + rightFovR );
-				var xOffset = zOffset * leftFovL;
-
-				// TODO: Better way to apply this offset?
-				this.cameras[ 0 ].matrixWorld.decompose( this.position, this.quaternion, this.scale );
-				this.translateX( xOffset );
-				this.translateZ( - zOffset );
-				this.matrixWorld.compose( this.position, this.quaternion, this.scale );
-				this.matrixWorldInverse.getInverse( this.matrixWorld );
-
-				// Find the union of the frustum values of the cameras and scale
-				// the values so that the near plane's position does not change in world space,
-				// although must now be relative to the new union camera.
-				var near2 = near + zOffset;
-				var far2 = far + zOffset;
-				var left = leftL - xOffset;
-				var right = rightR + ( ipd - xOffset );
-				var top = Math.max( topL, topR );
-				var bottom = Math.min( bottomL, bottomR );
-
-				this.projectionMatrix.makePerspective( left, right, top, bottom, near2, far2 );
+	} );
 
-			};
+	/**
+	 * @author jsantell / https://www.jsantell.com/
+	 * @author mrdoob / http://mrdoob.com/
+	 */
 
-		}(),
+	var cameraLPos = new Vector3();
+	var cameraRPos = new Vector3();
 
-	} );
+	/**
+	 * Assumes 2 cameras that are perpendicular and share an X-axis, and that
+	 * the cameras' projection and world matrices have already been set.
+	 * And that near and far planes are identical for both cameras.
+	 */
+	function setProjectionFromUnion( camera, cameraL, cameraR ) {
+
+		cameraLPos.setFromMatrixPosition( cameraL.matrixWorld );
+		cameraRPos.setFromMatrixPosition( cameraR.matrixWorld );
+
+		var ipd = cameraLPos.distanceTo( cameraRPos );
+
+		var projL = cameraL.projectionMatrix;
+		var projR = cameraR.projectionMatrix;
+
+		// VR systems will have identical far and near planes, and
+		// most likely identical top and bottom frustum extents.
+		// via: https://computergraphics.stackexchange.com/a/4765
+		var near = projL[ 14 ] / ( projL[ 10 ] - 1 );
+		var far = projL[ 14 ] / ( projL[ 10 ] + 1 );
+
+		var leftFovL = ( projL[ 8 ] - 1 ) / projL[ 0 ];
+		var rightFovR = ( projR[ 8 ] + 1 ) / projR[ 0 ];
+		var leftL = leftFovL * near;
+		var rightR = rightFovR * near;
+		var topL = near * ( projL[ 9 ] + 1 ) / projL[ 5 ];
+		var topR = near * ( projR[ 9 ] + 1 ) / projR[ 5 ];
+		var bottomL = near * ( projL[ 9 ] - 1 ) / projL[ 5 ];
+		var bottomR = near * ( projR[ 9 ] - 1 ) / projR[ 5 ];
+
+		// Calculate the new camera's position offset from the
+		// left camera.
+		var zOffset = ipd / ( leftFovL + rightFovR );
+		var xOffset = zOffset * leftFovL;
+
+		// TODO: Better way to apply this offset?
+		cameraL.matrixWorld.decompose( camera.position, camera.quaternion, camera.scale );
+		camera.translateX( xOffset );
+		camera.translateZ( - zOffset );
+		camera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale );
+		camera.matrixWorldInverse.getInverse( camera.matrixWorld );
+
+		// Find the union of the frustum values of the cameras and scale
+		// the values so that the near plane's position does not change in world space,
+		// although must now be relative to the new union camera.
+		var near2 = near + zOffset;
+		var far2 = far + zOffset;
+		var left = leftL - xOffset;
+		var right = rightR + ( ipd - xOffset );
+		var top = Math.max( topL, topR );
+		var bottom = Math.min( bottomL, bottomR );
+
+		camera.projectionMatrix.makePerspective( left, right, top, bottom, near2, far2 );
+
+	}
 
 	/**
 	 * @author mrdoob / http://mrdoob.com/
@@ -21645,7 +21648,7 @@
 			cameraL.projectionMatrix.fromArray( frameData.leftProjectionMatrix );
 			cameraR.projectionMatrix.fromArray( frameData.rightProjectionMatrix );
 
-			cameraVR.setProjectionFromUnion();
+			setProjectionFromUnion( cameraVR, cameraL, cameraR );
 
 			//
 
@@ -21888,7 +21891,7 @@
 
 				}
 
-				cameraVR.setProjectionFromUnion();
+				setProjectionFromUnion( cameraVR, cameraL, cameraR );
 
 				return cameraVR;
 

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


+ 67 - 64
build/three.module.js

@@ -14650,6 +14650,7 @@ function WebGLBackground( renderer, state, objects, premultipliedAlpha ) {
 			boxMesh.material.uniforms.tCube.value = ( background.isWebGLRenderTargetCube ) ? background.texture : background;
 			boxMesh.material.uniforms.tFlip.value = ( background.isWebGLRenderTargetCube ) ? 1 : - 1;
 
+			// push to the pre-sorted opaque render list
 			renderList.push( boxMesh, boxMesh.geometry, boxMesh.material, 0, null );
 
 		} else if ( background && background.isTexture ) {
@@ -14677,6 +14678,7 @@ function WebGLBackground( renderer, state, objects, premultipliedAlpha ) {
 
 			planeMesh.material.uniforms.t2D.value = background;
 
+			// push to the pre-sorted opaque render list
 			renderList.push( planeMesh, planeMesh.geometry, planeMesh.material, 0, null );
 
 		}
@@ -21256,72 +21258,73 @@ ArrayCamera.prototype = Object.assign( Object.create( PerspectiveCamera.prototyp
 
 	constructor: ArrayCamera,
 
-	isArrayCamera: true,
+	isArrayCamera: true
 
-	/**
-	 * Assumes 2 cameras that are perpendicular and share an X-axis, and that
-	 * the cameras' projection and world matrices have already been set.
-	 * And that near and far planes are identical for both cameras.
-	 */
-	setProjectionFromUnion: function () {
-
-		var cameraLPos = new Vector3();
-		var cameraRPos = new Vector3();
-
-		return function () {
-
-			cameraLPos.setFromMatrixPosition( this.cameras[ 0 ].matrixWorld );
-			cameraRPos.setFromMatrixPosition( this.cameras[ 1 ].matrixWorld );
-
-			var ipd = cameraLPos.distanceTo( cameraRPos );
-
-			var projL = this.cameras[ 0 ].projectionMatrix;
-			var projR = this.cameras[ 1 ].projectionMatrix;
-
-			// VR systems will have identical far and near planes, and
-			// most likely identical top and bottom frustum extents.
-			// via: https://computergraphics.stackexchange.com/a/4765
-			var near = projL[ 14 ] / ( projL[ 10 ] - 1 );
-			var far = projL[ 14 ] / ( projL[ 10 ] + 1 );
-
-			var leftFovL = ( projL[ 8 ] - 1 ) / projL[ 0 ];
-			var rightFovR = ( projR[ 8 ] + 1 ) / projR[ 0 ];
-			var leftL = leftFovL * near;
-			var rightR = rightFovR * near;
-			var topL = near * ( projL[ 9 ] + 1 ) / projL[ 5 ];
-			var topR = near * ( projR[ 9 ] + 1 ) / projR[ 5 ];
-			var bottomL = near * ( projL[ 9 ] - 1 ) / projL[ 5 ];
-			var bottomR = near * ( projR[ 9 ] - 1 ) / projR[ 5 ];
-
-			// Calculate the new camera's position offset from the
-			// left camera.
-			var zOffset = ipd / ( leftFovL + rightFovR );
-			var xOffset = zOffset * leftFovL;
-
-			// TODO: Better way to apply this offset?
-			this.cameras[ 0 ].matrixWorld.decompose( this.position, this.quaternion, this.scale );
-			this.translateX( xOffset );
-			this.translateZ( - zOffset );
-			this.matrixWorld.compose( this.position, this.quaternion, this.scale );
-			this.matrixWorldInverse.getInverse( this.matrixWorld );
-
-			// Find the union of the frustum values of the cameras and scale
-			// the values so that the near plane's position does not change in world space,
-			// although must now be relative to the new union camera.
-			var near2 = near + zOffset;
-			var far2 = far + zOffset;
-			var left = leftL - xOffset;
-			var right = rightR + ( ipd - xOffset );
-			var top = Math.max( topL, topR );
-			var bottom = Math.min( bottomL, bottomR );
-
-			this.projectionMatrix.makePerspective( left, right, top, bottom, near2, far2 );
+} );
 
-		};
+/**
+ * @author jsantell / https://www.jsantell.com/
+ * @author mrdoob / http://mrdoob.com/
+ */
 
-	}(),
+var cameraLPos = new Vector3();
+var cameraRPos = new Vector3();
 
-} );
+/**
+ * Assumes 2 cameras that are perpendicular and share an X-axis, and that
+ * the cameras' projection and world matrices have already been set.
+ * And that near and far planes are identical for both cameras.
+ */
+function setProjectionFromUnion( camera, cameraL, cameraR ) {
+
+	cameraLPos.setFromMatrixPosition( cameraL.matrixWorld );
+	cameraRPos.setFromMatrixPosition( cameraR.matrixWorld );
+
+	var ipd = cameraLPos.distanceTo( cameraRPos );
+
+	var projL = cameraL.projectionMatrix;
+	var projR = cameraR.projectionMatrix;
+
+	// VR systems will have identical far and near planes, and
+	// most likely identical top and bottom frustum extents.
+	// via: https://computergraphics.stackexchange.com/a/4765
+	var near = projL[ 14 ] / ( projL[ 10 ] - 1 );
+	var far = projL[ 14 ] / ( projL[ 10 ] + 1 );
+
+	var leftFovL = ( projL[ 8 ] - 1 ) / projL[ 0 ];
+	var rightFovR = ( projR[ 8 ] + 1 ) / projR[ 0 ];
+	var leftL = leftFovL * near;
+	var rightR = rightFovR * near;
+	var topL = near * ( projL[ 9 ] + 1 ) / projL[ 5 ];
+	var topR = near * ( projR[ 9 ] + 1 ) / projR[ 5 ];
+	var bottomL = near * ( projL[ 9 ] - 1 ) / projL[ 5 ];
+	var bottomR = near * ( projR[ 9 ] - 1 ) / projR[ 5 ];
+
+	// Calculate the new camera's position offset from the
+	// left camera.
+	var zOffset = ipd / ( leftFovL + rightFovR );
+	var xOffset = zOffset * leftFovL;
+
+	// TODO: Better way to apply this offset?
+	cameraL.matrixWorld.decompose( camera.position, camera.quaternion, camera.scale );
+	camera.translateX( xOffset );
+	camera.translateZ( - zOffset );
+	camera.matrixWorld.compose( camera.position, camera.quaternion, camera.scale );
+	camera.matrixWorldInverse.getInverse( camera.matrixWorld );
+
+	// Find the union of the frustum values of the cameras and scale
+	// the values so that the near plane's position does not change in world space,
+	// although must now be relative to the new union camera.
+	var near2 = near + zOffset;
+	var far2 = far + zOffset;
+	var left = leftL - xOffset;
+	var right = rightR + ( ipd - xOffset );
+	var top = Math.max( topL, topR );
+	var bottom = Math.min( bottomL, bottomR );
+
+	camera.projectionMatrix.makePerspective( left, right, top, bottom, near2, far2 );
+
+}
 
 /**
  * @author mrdoob / http://mrdoob.com/
@@ -21639,7 +21642,7 @@ function WebVRManager( renderer ) {
 		cameraL.projectionMatrix.fromArray( frameData.leftProjectionMatrix );
 		cameraR.projectionMatrix.fromArray( frameData.rightProjectionMatrix );
 
-		cameraVR.setProjectionFromUnion();
+		setProjectionFromUnion( cameraVR, cameraL, cameraR );
 
 		//
 
@@ -21882,7 +21885,7 @@ function WebXRManager( renderer ) {
 
 			}
 
-			cameraVR.setProjectionFromUnion();
+			setProjectionFromUnion( cameraVR, cameraL, cameraR );
 
 			return cameraVR;
 

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