浏览代码

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

Takahiro 6 年之前
父节点
当前提交
3e72508af6
共有 1 个文件被更改,包括 2 次插入6 次删除
  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
 			};