2
0
Эх сурвалжийг харах

Gyroscope: Public properties to local.

Mr.doob 11 жил өмнө
parent
commit
28e6e6cce0

+ 0 - 32
docs/api/extras/core/Gyroscope.html

@@ -26,41 +26,9 @@
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 
 
 
 
-
-		<h3>.[page:Vector3 scaleWorld]</h3>
-		<div>
-		todo
-		</div> 
-
-		<h3>.[page:Vector3 translationWorld]</h3>
-		<div>
-		todo
-		</div> 
-
-		<h3>.[page:Quaternion rotationWorld]</h3>
-		<div>
-		todo
-		</div> 
-
-		<h3>.[page:Vector3 translationObject]</h3>
-		<div>
-		todo
-		</div> 
-
-		<h3>.[page:Vector3 scaleObject]</h3>
-		<div>
-		todo
-		</div> 
-
-		<h3>.[page:Quaternion rotationObject]</h3>
-		<div>
-		todo
-		</div> 
-
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
 
 
-
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 30 - 26
src/extras/core/Gyroscope.js

@@ -10,51 +10,55 @@ THREE.Gyroscope = function () {
 
 
 THREE.Gyroscope.prototype = Object.create( THREE.Object3D.prototype );
 THREE.Gyroscope.prototype = Object.create( THREE.Object3D.prototype );
 
 
-THREE.Gyroscope.prototype.updateMatrixWorld = function ( force ) {
+THREE.Gyroscope.prototype.updateMatrixWorld = ( function () {
 
 
-	this.matrixAutoUpdate && this.updateMatrix();
+	var translationObject = new THREE.Vector3();
+	var quaternionObject = new THREE.Quaternion();
+	var scaleObject = new THREE.Vector3();
 
 
-	// update matrixWorld
+	var translationWorld = new THREE.Vector3();
+	var quaternionWorld = new THREE.Quaternion();
+	var scaleWorld = new THREE.Vector3();
 
 
-	if ( this.matrixWorldNeedsUpdate || force ) {
+	return function ( force ) {
 
 
-		if ( this.parent ) {
+		this.matrixAutoUpdate && this.updateMatrix();
 
 
-			this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );
+		// update matrixWorld
 
 
-			this.matrixWorld.decompose( this.translationWorld, this.quaternionWorld, this.scaleWorld );
-			this.matrix.decompose( this.translationObject, this.quaternionObject, this.scaleObject );
+		if ( this.matrixWorldNeedsUpdate || force ) {
 
 
-			this.matrixWorld.compose( this.translationWorld, this.quaternionObject, this.scaleWorld );
+			if ( this.parent ) {
 
 
+				this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );
 
 
-		} else {
+				this.matrixWorld.decompose( translationWorld, quaternionWorld, scaleWorld );
+				this.matrix.decompose( translationObject, quaternionObject, scaleObject );
 
 
-			this.matrixWorld.copy( this.matrix );
+				this.matrixWorld.compose( translationWorld, quaternionObject, scaleWorld );
 
 
-		}
 
 
+			} else {
 
 
-		this.matrixWorldNeedsUpdate = false;
+				this.matrixWorld.copy( this.matrix );
 
 
-		force = true;
+			}
 
 
-	}
 
 
-	// update children
+			this.matrixWorldNeedsUpdate = false;
 
 
-	for ( var i = 0, l = this.children.length; i < l; i ++ ) {
+			force = true;
 
 
-		this.children[ i ].updateMatrixWorld( force );
+		}
 
 
-	}
+		// update children
 
 
-};
+		for ( var i = 0, l = this.children.length; i < l; i ++ ) {
 
 
-THREE.Gyroscope.prototype.translationWorld = new THREE.Vector3();
-THREE.Gyroscope.prototype.translationObject = new THREE.Vector3();
-THREE.Gyroscope.prototype.quaternionWorld = new THREE.Quaternion();
-THREE.Gyroscope.prototype.quaternionObject = new THREE.Quaternion();
-THREE.Gyroscope.prototype.scaleWorld = new THREE.Vector3();
-THREE.Gyroscope.prototype.scaleObject = new THREE.Vector3();
+			this.children[ i ].updateMatrixWorld( force );
+
+		}
 
 
+	};
+	
+}() );