Browse Source

Euler code clean up.

Mr.doob 10 years ago
parent
commit
738a7d0a99
1 changed files with 13 additions and 12 deletions
  1. 13 12
      src/math/Euler.js

+ 13 - 12
src/math/Euler.js

@@ -224,18 +224,19 @@ THREE.Euler.prototype = {
 
 	},
 
-	setFromQuaternion: function() {
-
-	   var mIntermediate = null;
-	   
-	   return function( q, order, update ) {
-	   
-	   	  mIntermediate = mIntermediate || new THREE.Matrix4();
-	      mIntermediate.makeRotationFromQuaternion( q );
-	      this.setFromRotationMatrix( mIntermediate, order, update );
-	   
-	      return this;
-	   };
+	setFromQuaternion: function () {
+
+		var matrix;
+
+		return function ( q, order, update ) {
+
+			if ( matrix === undefined ) matrix = new THREE.Matrix4();
+			matrix.makeRotationFromQuaternion( q );
+			this.setFromRotationMatrix( matrix, order, update );
+
+			return this;
+
+		};
 
 	}(),