Browse Source

Revert "Improve BufferGeometry closure performance"

This reverts commit 1be82538036931f87fb068f7d6fa85ea60681070.
Joe Fox 8 years ago
parent
commit
99e5db7dc7
1 changed files with 18 additions and 6 deletions
  1. 18 6
      src/core/BufferGeometry.js

+ 18 - 6
src/core/BufferGeometry.js

@@ -173,10 +173,12 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
 
 		// rotate geometry around world x-axis
 
-		var m1 = new Matrix4();
+		var m1;
 
 		return function rotateX( angle ) {
 
+			if ( m1 === undefined ) m1 = new Matrix4();
+
 			m1.makeRotationX( angle );
 
 			this.applyMatrix( m1 );
@@ -191,10 +193,12 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
 
 		// rotate geometry around world y-axis
 
-		var m1 = new Matrix4();
+		var m1;
 
 		return function rotateY( angle ) {
 
+			if ( m1 === undefined ) m1 = new Matrix4();
+
 			m1.makeRotationY( angle );
 
 			this.applyMatrix( m1 );
@@ -209,10 +213,12 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
 
 		// rotate geometry around world z-axis
 
-		var m1 = new Matrix4();
+		var m1;
 
 		return function rotateZ( angle ) {
 
+			if ( m1 === undefined ) m1 = new Matrix4();
+
 			m1.makeRotationZ( angle );
 
 			this.applyMatrix( m1 );
@@ -227,10 +233,12 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
 
 		// translate geometry
 
-		var m1 = new Matrix4();
+		var m1;
 
 		return function translate( x, y, z ) {
 
+			if ( m1 === undefined ) m1 = new Matrix4();
+
 			m1.makeTranslation( x, y, z );
 
 			this.applyMatrix( m1 );
@@ -245,10 +253,12 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
 
 		// scale geometry
 
-		var m1 = new Matrix4();
+		var m1;
 
 		return function scale( x, y, z ) {
 
+			if ( m1 === undefined ) m1 = new Matrix4();
+
 			m1.makeScale( x, y, z );
 
 			this.applyMatrix( m1 );
@@ -261,10 +271,12 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
 
 	lookAt: function () {
 
-		var obj = new Object3D();
+		var obj;
 
 		return function lookAt( vector ) {
 
+			if ( obj === undefined ) obj = new Object3D();
+
 			obj.lookAt( vector );
 
 			obj.updateMatrix();