Explorar o código

Merge pull request #14802 from joshpatt2/standing-fix

Add back in support for turning off standing in VRManager.  This is
Mr.doob %!s(int64=7) %!d(string=hai) anos
pai
achega
f468cf5b92
Modificáronse 2 ficheiros con 16 adicións e 21 borrados
  1. 0 14
      src/Three.Legacy.js
  2. 16 7
      src/renderers/webvr/WebVRManager.js

+ 0 - 14
src/Three.Legacy.js

@@ -1683,20 +1683,6 @@ Object.defineProperties( WebGLRenderTarget.prototype, {
 
 //
 
-Object.defineProperties( WebVRManager.prototype, {
-
-	standing: {
-		set: function ( /* value */ ) {
-
-			console.warn( 'THREE.WebVRManager: .standing has been removed.' );
-
-		}
-	}
-
-} );
-
-//
-
 Audio.prototype.load = function ( file ) {
 
 	console.warn( 'THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.' );

+ 16 - 7
src/renderers/webvr/WebVRManager.js

@@ -174,6 +174,7 @@ function WebVRManager( renderer ) {
 
 	this.enabled = false;
 	this.userHeight = 1.6;
+	this.standing = false;
 
 	this.getController = function ( id ) {
 
@@ -229,15 +230,19 @@ function WebVRManager( renderer ) {
 
 		//
 
-		var stageParameters = device.stageParameters;
+		if ( this.standing ) {
 
-		if ( stageParameters ) {
+			var stageParameters = device.stageParameters;
 
-			standingMatrix.fromArray( stageParameters.sittingToStandingTransform );
+			if ( stageParameters ) {
 
-		} else {
+				standingMatrix.fromArray( stageParameters.sittingToStandingTransform );
+
+			} else {
+
+				standingMatrix.makeTranslation( 0, scope.userHeight, 0 );
 
-			standingMatrix.makeTranslation( 0, scope.userHeight, 0 );
+			}
 
 		}
 
@@ -287,8 +292,12 @@ function WebVRManager( renderer ) {
 
 		standingMatrixInverse.getInverse( standingMatrix );
 
-		cameraL.matrixWorldInverse.multiply( standingMatrixInverse );
-		cameraR.matrixWorldInverse.multiply( standingMatrixInverse );
+		if ( this.standing ) {
+
+			cameraL.matrixWorldInverse.multiply( standingMatrixInverse );
+			cameraR.matrixWorldInverse.multiply( standingMatrixInverse );
+
+		}
 
 		var parent = poseObject.parent;