Ver código fonte

Simplified DeviceOrientationControls.

Mr.doob 11 anos atrás
pai
commit
fd313da81c
1 arquivos alterados com 8 adições e 14 exclusões
  1. 8 14
      examples/js/controls/DeviceOrientationControls.js

+ 8 - 14
examples/js/controls/DeviceOrientationControls.js

@@ -29,24 +29,18 @@ THREE.DeviceOrientationControls = function ( object ) {
 
 	};
 
-	this.update = function() {
+	this.update = function () {
 
-		var alpha, beta, gamma;
+		if ( this.freeze ) return;
 
-		return function () {
-
-			if ( this.freeze ) return;
+		var alpha  = this.deviceOrientation.gamma ? THREE.Math.degToRad( this.deviceOrientation.alpha ) : 0; // Z
+		var beta   = this.deviceOrientation.beta  ? THREE.Math.degToRad( this.deviceOrientation.beta  ) : 0; // X'
+		var gamma  = this.deviceOrientation.gamma ? THREE.Math.degToRad( this.deviceOrientation.gamma ) : 0; // Y''
+		var orient = this.screenOrientation       ? THREE.Math.degToRad( this.screenOrientation       ) : 0; // O
 
-			alpha  = this.deviceOrientation.gamma ? THREE.Math.degToRad( this.deviceOrientation.alpha ) : 0; // Z
-			beta   = this.deviceOrientation.beta  ? THREE.Math.degToRad( this.deviceOrientation.beta  ) : 0; // X'
-			gamma  = this.deviceOrientation.gamma ? THREE.Math.degToRad( this.deviceOrientation.gamma ) : 0; // Y''
-			orient = this.screenOrientation       ? THREE.Math.degToRad( this.screenOrientation       ) : 0; // O
+		setObjectQuaternion( this.object.quaternion, alpha, beta, gamma, orient );
 
-			setObjectQuaternion( this.object.quaternion, alpha, beta, gamma, orient );
-
-		}
-
-	}();
+	};
 
 	function bind( scope, fn ) {