浏览代码

Updated builds.

Mr.doob 7 年之前
父节点
当前提交
00a63e1849
共有 3 个文件被更改,包括 182 次插入418 次删除
  1. 38 19
      build/three.js
  2. 106 380
      build/three.min.js
  3. 38 19
      build/three.module.js

+ 38 - 19
build/three.js

@@ -19867,6 +19867,9 @@
 
 		var poseTarget = null;
 
+		var standingMatrix = new Matrix4();
+		var standingMatrixInverse = new Matrix4();
+
 		if ( typeof window !== 'undefined' && 'VRFrameData' in window ) {
 
 			frameData = new window.VRFrameData();
@@ -19921,6 +19924,7 @@
 		//
 
 		this.enabled = false;
+		this.userHeight = 1.6;
 
 		this.getDevice = function () {
 
@@ -19970,6 +19974,19 @@
 
 			}
 
+			var stageParameters = device.stageParameters;
+
+			if ( stageParameters ) {
+
+				standingMatrix.fromArray( stageParameters.sittingToStandingTransform );
+
+			} else {
+
+				standingMatrix.makeTranslation( 0, scope.userHeight, 0 );
+
+			}
+
+			poseObject.position.applyMatrix4( standingMatrix );
 			poseObject.updateMatrixWorld();
 
 			if ( device.isPresenting === false ) return camera;
@@ -19988,6 +20005,13 @@
 			cameraL.matrixWorldInverse.fromArray( frameData.leftViewMatrix );
 			cameraR.matrixWorldInverse.fromArray( frameData.rightViewMatrix );
 
+			// TODO (mrdoob) Double check this code
+
+			standingMatrixInverse.getInverse( standingMatrix );
+
+			cameraL.matrixWorldInverse.multiply( standingMatrixInverse );
+			cameraR.matrixWorldInverse.multiply( standingMatrixInverse );
+
 			var parent = poseObject.parent;
 
 			if ( parent !== null ) {
@@ -20007,7 +20031,7 @@
 			cameraL.projectionMatrix.fromArray( frameData.leftProjectionMatrix );
 			cameraR.projectionMatrix.fromArray( frameData.rightProjectionMatrix );
 
-			// HACK @mrdoob
+			// HACK (mrdoob)
 			// https://github.com/w3c/webvr/issues/203
 
 			cameraVR.projectionMatrix.copy( cameraL.projectionMatrix );
@@ -20038,6 +20062,12 @@
 
 		};
 
+		this.getStandingMatrix = function () {
+
+			return standingMatrix;
+
+		};
+
 		this.submitFrame = function () {
 
 			if ( device && device.isPresenting ) device.submitFrame();
@@ -20527,12 +20557,16 @@
 
 	}
 
-	function WebGLLights( stateId ) {
+	var count = 0;
+
+	function WebGLLights() {
 
 		var cache = new UniformsCache();
 
 		var state = {
 
+			id: count ++,
+
 			hash: '',
 
 			ambient: [ 0, 0, 0 ],
@@ -20739,8 +20773,7 @@
 			state.point.length = pointLength;
 			state.hemi.length = hemiLength;
 
-			// TODO (sam-g-steel) why aren't we using join
-			state.hash = directionalLength + ',' + pointLength + ',' + spotLength + ',' + rectAreaLength + ',' + hemiLength + ',' + shadows.length + ',' + stateId;
+			state.hash = state.id + ',' + directionalLength + ',' + pointLength + ',' + spotLength + ',' + rectAreaLength + ',' + hemiLength + ',' + shadows.length;
 
 		}
 
@@ -20755,13 +20788,9 @@
 	 * @author Mugen87 / https://github.com/Mugen87
 	 */
 
-	var count = 0;
-
 	function WebGLRenderState() {
 
-		var id = count ++;
-
-		var lights = new WebGLLights( id );
+		var lights = new WebGLLights();
 
 		var lightsArray = [];
 		var shadowsArray = [];
@@ -45311,16 +45340,6 @@
 
 	//
 
-	Object.assign( WebVRManager.prototype, {
-
-		getStandingMatrix: function () {
-
-			console.warn( 'THREE.WebVRManager: .getStandingMatrix() has been removed.' );
-
-		}
-
-	} );
-
 	Object.defineProperties( WebVRManager.prototype, {
 
 		standing: {

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


+ 38 - 19
build/three.module.js

@@ -19861,6 +19861,9 @@ function WebVRManager( renderer ) {
 
 	var poseTarget = null;
 
+	var standingMatrix = new Matrix4();
+	var standingMatrixInverse = new Matrix4();
+
 	if ( typeof window !== 'undefined' && 'VRFrameData' in window ) {
 
 		frameData = new window.VRFrameData();
@@ -19915,6 +19918,7 @@ function WebVRManager( renderer ) {
 	//
 
 	this.enabled = false;
+	this.userHeight = 1.6;
 
 	this.getDevice = function () {
 
@@ -19964,6 +19968,19 @@ function WebVRManager( renderer ) {
 
 		}
 
+		var stageParameters = device.stageParameters;
+
+		if ( stageParameters ) {
+
+			standingMatrix.fromArray( stageParameters.sittingToStandingTransform );
+
+		} else {
+
+			standingMatrix.makeTranslation( 0, scope.userHeight, 0 );
+
+		}
+
+		poseObject.position.applyMatrix4( standingMatrix );
 		poseObject.updateMatrixWorld();
 
 		if ( device.isPresenting === false ) return camera;
@@ -19982,6 +19999,13 @@ function WebVRManager( renderer ) {
 		cameraL.matrixWorldInverse.fromArray( frameData.leftViewMatrix );
 		cameraR.matrixWorldInverse.fromArray( frameData.rightViewMatrix );
 
+		// TODO (mrdoob) Double check this code
+
+		standingMatrixInverse.getInverse( standingMatrix );
+
+		cameraL.matrixWorldInverse.multiply( standingMatrixInverse );
+		cameraR.matrixWorldInverse.multiply( standingMatrixInverse );
+
 		var parent = poseObject.parent;
 
 		if ( parent !== null ) {
@@ -20001,7 +20025,7 @@ function WebVRManager( renderer ) {
 		cameraL.projectionMatrix.fromArray( frameData.leftProjectionMatrix );
 		cameraR.projectionMatrix.fromArray( frameData.rightProjectionMatrix );
 
-		// HACK @mrdoob
+		// HACK (mrdoob)
 		// https://github.com/w3c/webvr/issues/203
 
 		cameraVR.projectionMatrix.copy( cameraL.projectionMatrix );
@@ -20032,6 +20056,12 @@ function WebVRManager( renderer ) {
 
 	};
 
+	this.getStandingMatrix = function () {
+
+		return standingMatrix;
+
+	};
+
 	this.submitFrame = function () {
 
 		if ( device && device.isPresenting ) device.submitFrame();
@@ -20521,12 +20551,16 @@ function UniformsCache() {
 
 }
 
-function WebGLLights( stateId ) {
+var count = 0;
+
+function WebGLLights() {
 
 	var cache = new UniformsCache();
 
 	var state = {
 
+		id: count ++,
+
 		hash: '',
 
 		ambient: [ 0, 0, 0 ],
@@ -20733,8 +20767,7 @@ function WebGLLights( stateId ) {
 		state.point.length = pointLength;
 		state.hemi.length = hemiLength;
 
-		// TODO (sam-g-steel) why aren't we using join
-		state.hash = directionalLength + ',' + pointLength + ',' + spotLength + ',' + rectAreaLength + ',' + hemiLength + ',' + shadows.length + ',' + stateId;
+		state.hash = state.id + ',' + directionalLength + ',' + pointLength + ',' + spotLength + ',' + rectAreaLength + ',' + hemiLength + ',' + shadows.length;
 
 	}
 
@@ -20749,13 +20782,9 @@ function WebGLLights( stateId ) {
  * @author Mugen87 / https://github.com/Mugen87
  */
 
-var count = 0;
-
 function WebGLRenderState() {
 
-	var id = count ++;
-
-	var lights = new WebGLLights( id );
+	var lights = new WebGLLights();
 
 	var lightsArray = [];
 	var shadowsArray = [];
@@ -45305,16 +45334,6 @@ Object.defineProperties( WebGLRenderTarget.prototype, {
 
 //
 
-Object.assign( WebVRManager.prototype, {
-
-	getStandingMatrix: function () {
-
-		console.warn( 'THREE.WebVRManager: .getStandingMatrix() has been removed.' );
-
-	}
-
-} );
-
 Object.defineProperties( WebVRManager.prototype, {
 
 	standing: {

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