|
@@ -31,9 +31,21 @@ THREE.BufferGeometryLoader.prototype = {
|
|
|
|
|
|
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 ) {
|
|
|
|
|
|
- var typedArray = new self[ index.type ]( index.array );
|
|
|
+ var typedArray = new TYPED_ARRAYS[ index.type ]( index.array );
|
|
|
geometry.setIndex( new THREE.BufferAttribute( typedArray, 1 ) );
|
|
|
|
|
|
}
|
|
@@ -43,7 +55,7 @@ THREE.BufferGeometryLoader.prototype = {
|
|
|
for ( var key in attributes ) {
|
|
|
|
|
|
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 ) );
|
|
|
|