浏览代码

Updated builds.

Mr.doob 5 年之前
父节点
当前提交
d90276ca84
共有 3 个文件被更改,包括 341 次插入333 次删除
  1. 20 16
      build/three.js
  2. 301 301
      build/three.min.js
  3. 20 16
      build/three.module.js

+ 20 - 16
build/three.js

@@ -22777,8 +22777,6 @@
 		var device = null;
 		var frameData = null;
 
-		var poseTarget = null;
-
 		var controllers = [];
 		var standingMatrix = new Matrix4();
 		var standingMatrixInverse = new Matrix4();
@@ -22798,6 +22796,8 @@
 		var tempQuaternion = new Quaternion();
 		var tempPosition = new Vector3();
 
+		var tempCamera = new PerspectiveCamera();
+
 		var cameraL = new PerspectiveCamera();
 		cameraL.viewport = new Vector4();
 		cameraL.layers.enable( 1 );
@@ -23030,12 +23030,6 @@
 
 		};
 
-		this.setPoseTarget = function ( object ) {
-
-			if ( object !== undefined ) { poseTarget = object; }
-
-		};
-
 		this.getCamera = function ( camera ) {
 
 			var userHeight = referenceSpaceType === 'local-floor' ? 1.6 : 0;
@@ -23065,16 +23059,14 @@
 
 
 			var pose = frameData.pose;
-			var poseObject = poseTarget !== null ? poseTarget : camera;
 
-			// We want to manipulate poseObject by its position and quaternion components since users may rely on them.
-			poseObject.matrix.copy( standingMatrix );
-			poseObject.matrix.decompose( poseObject.position, poseObject.quaternion, poseObject.scale );
+			tempCamera.matrix.copy( standingMatrix );
+			tempCamera.matrix.decompose( tempCamera.position, tempCamera.quaternion, tempCamera.scale );
 
 			if ( pose.orientation !== null ) {
 
 				tempQuaternion.fromArray( pose.orientation );
-				poseObject.quaternion.multiply( tempQuaternion );
+				tempCamera.quaternion.multiply( tempQuaternion );
 
 			}
 
@@ -23083,11 +23075,23 @@
 				tempQuaternion.setFromRotationMatrix( standingMatrix );
 				tempPosition.fromArray( pose.position );
 				tempPosition.applyQuaternion( tempQuaternion );
-				poseObject.position.add( tempPosition );
+				tempCamera.position.add( tempPosition );
 
 			}
 
-			poseObject.updateMatrixWorld();
+			tempCamera.updateMatrixWorld();
+
+			//
+
+			camera.matrixWorld.copy( tempCamera.matrixWorld );
+
+			var children = camera.children;
+
+			for ( var i = 0, l = children.length; i < l; i ++ ) {
+
+				children[ i ].updateMatrixWorld( true );
+
+			}
 
 			//
 
@@ -23111,7 +23115,7 @@
 
 			}
 
-			var parent = poseObject.parent;
+			var parent = camera.parent;
 
 			if ( parent !== null ) {
 

文件差异内容过多而无法显示
+ 301 - 301
build/three.min.js


+ 20 - 16
build/three.module.js

@@ -22769,8 +22769,6 @@ function WebVRManager( renderer ) {
 	var device = null;
 	var frameData = null;
 
-	var poseTarget = null;
-
 	var controllers = [];
 	var standingMatrix = new Matrix4();
 	var standingMatrixInverse = new Matrix4();
@@ -22790,6 +22788,8 @@ function WebVRManager( renderer ) {
 	var tempQuaternion = new Quaternion();
 	var tempPosition = new Vector3();
 
+	var tempCamera = new PerspectiveCamera();
+
 	var cameraL = new PerspectiveCamera();
 	cameraL.viewport = new Vector4();
 	cameraL.layers.enable( 1 );
@@ -23022,12 +23022,6 @@ function WebVRManager( renderer ) {
 
 	};
 
-	this.setPoseTarget = function ( object ) {
-
-		if ( object !== undefined ) poseTarget = object;
-
-	};
-
 	this.getCamera = function ( camera ) {
 
 		var userHeight = referenceSpaceType === 'local-floor' ? 1.6 : 0;
@@ -23057,16 +23051,14 @@ function WebVRManager( renderer ) {
 
 
 		var pose = frameData.pose;
-		var poseObject = poseTarget !== null ? poseTarget : camera;
 
-		// We want to manipulate poseObject by its position and quaternion components since users may rely on them.
-		poseObject.matrix.copy( standingMatrix );
-		poseObject.matrix.decompose( poseObject.position, poseObject.quaternion, poseObject.scale );
+		tempCamera.matrix.copy( standingMatrix );
+		tempCamera.matrix.decompose( tempCamera.position, tempCamera.quaternion, tempCamera.scale );
 
 		if ( pose.orientation !== null ) {
 
 			tempQuaternion.fromArray( pose.orientation );
-			poseObject.quaternion.multiply( tempQuaternion );
+			tempCamera.quaternion.multiply( tempQuaternion );
 
 		}
 
@@ -23075,11 +23067,23 @@ function WebVRManager( renderer ) {
 			tempQuaternion.setFromRotationMatrix( standingMatrix );
 			tempPosition.fromArray( pose.position );
 			tempPosition.applyQuaternion( tempQuaternion );
-			poseObject.position.add( tempPosition );
+			tempCamera.position.add( tempPosition );
 
 		}
 
-		poseObject.updateMatrixWorld();
+		tempCamera.updateMatrixWorld();
+
+		//
+
+		camera.matrixWorld.copy( tempCamera.matrixWorld );
+
+		var children = camera.children;
+
+		for ( var i = 0, l = children.length; i < l; i ++ ) {
+
+			children[ i ].updateMatrixWorld( true );
+
+		}
 
 		//
 
@@ -23103,7 +23107,7 @@ function WebVRManager( renderer ) {
 
 		}
 
-		var parent = poseObject.parent;
+		var parent = camera.parent;
 
 		if ( parent !== null ) {
 

部分文件因为文件数量过多而无法显示