提交 d935a878 编写于 作者: D dubejf

BufferAttribute: Simplify cloning

Update to mrdoob/three.js#5262
上级 1466707f
......@@ -104,26 +104,7 @@ THREE.BufferAttribute.prototype = {
clone: function () {
var attribute = new THREE.BufferAttribute( null, this.itemSize );
var types = [ Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array ];
var sourceArray = this.array;
for ( var i = 0, il = types.length; i < il; i ++ ) {
var type = types[ i ];
if ( sourceArray instanceof type ) {
attribute.array = new type( sourceArray );
break;
}
}
return attribute;
return new THREE.BufferAttribute( new this.array.constructor( this.array ), this.itemSize );
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册