Browse Source

Minor clean up BufferGeometry.toJSON(), removeing unnecessary temporal variables

Takahiro 6 years ago
parent
commit
3e72508af6
1 changed files with 2 additions and 6 deletions
  1. 2 6
      src/core/BufferGeometry.js

+ 2 - 6
src/core/BufferGeometry.js

@@ -986,11 +986,9 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
 
 		if ( index !== null ) {
 
-			var array = Array.prototype.slice.call( index.array );
-
 			data.data.index = {
 				type: index.array.constructor.name,
-				array: array
+				array: Array.prototype.slice.call( index.array )
 			};
 
 		}
@@ -1001,12 +999,10 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
 
 			var attribute = attributes[ key ];
 
-			var array = Array.prototype.slice.call( attribute.array );
-
 			var attributeData = {
 				itemSize: attribute.itemSize,
 				type: attribute.array.constructor.name,
-				array: array,
+				array: Array.prototype.slice.call( attribute.array ),
 				normalized: attribute.normalized
 			};