提交 f5efb5e4 编写于 作者: M Mr.doob

BufferGeometryLoader: Use internal object instead of relying on self. See #7787.

上级 b77265cb
...@@ -31,9 +31,21 @@ THREE.BufferGeometryLoader.prototype = { ...@@ -31,9 +31,21 @@ THREE.BufferGeometryLoader.prototype = {
var index = json.data.index; var index = json.data.index;
var TYPED_ARRAYS = {
'Int8Array': Int8Array,
'Uint8Array': Uint8Array,
'Uint8ClampedArray': Uint8ClampedArray,
'Int16Array': Int16Array,
'Uint16Array': Uint16Array,
'Int32Array': Int32Array,
'Uint32Array': Uint32Array,
'Float32Array': Float32Array,
'Float64Array': Float64Array
};
if ( index !== undefined ) { if ( index !== undefined ) {
var typedArray = new self[ index.type ]( index.array ); var typedArray = new TYPED_ARRAYS[ index.type ]( index.array );
geometry.setIndex( new THREE.BufferAttribute( typedArray, 1 ) ); geometry.setIndex( new THREE.BufferAttribute( typedArray, 1 ) );
} }
...@@ -43,7 +55,7 @@ THREE.BufferGeometryLoader.prototype = { ...@@ -43,7 +55,7 @@ THREE.BufferGeometryLoader.prototype = {
for ( var key in attributes ) { for ( var key in attributes ) {
var attribute = attributes[ key ]; var attribute = attributes[ key ];
var typedArray = new self[ attribute.type ]( attribute.array ); var typedArray = new TYPED_ARRAYS[ attribute.type ]( attribute.array );
geometry.addAttribute( key, new THREE.BufferAttribute( typedArray, attribute.itemSize ) ); geometry.addAttribute( key, new THREE.BufferAttribute( typedArray, attribute.itemSize ) );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册