|
@@ -8,6 +8,7 @@ import { InstancedBufferGeometry } from '../core/InstancedBufferGeometry.js';
|
|
|
import { InstancedBufferAttribute } from '../core/InstancedBufferAttribute.js';
|
|
|
import { InterleavedBufferAttribute } from '../core/InterleavedBufferAttribute.js';
|
|
|
import { InterleavedBuffer } from '../core/InterleavedBuffer.js';
|
|
|
+import { getTypedArray } from '../utils.js';
|
|
|
|
|
|
function BufferGeometryLoader( manager ) {
|
|
|
|
|
@@ -67,7 +68,7 @@ BufferGeometryLoader.prototype = Object.assign( Object.create( Loader.prototype
|
|
|
|
|
|
const buffer = getArrayBuffer( json, interleavedBuffer.buffer );
|
|
|
|
|
|
- const array = new TYPED_ARRAYS[ interleavedBuffer.type ]( buffer );
|
|
|
+ const array = getTypedArray( interleavedBuffer.type, buffer );
|
|
|
const ib = new InterleavedBuffer( array, interleavedBuffer.stride );
|
|
|
ib.uuid = interleavedBuffer.uuid;
|
|
|
|
|
@@ -98,7 +99,7 @@ BufferGeometryLoader.prototype = Object.assign( Object.create( Loader.prototype
|
|
|
|
|
|
if ( index !== undefined ) {
|
|
|
|
|
|
- const typedArray = new TYPED_ARRAYS[ index.type ]( index.array );
|
|
|
+ const typedArray = getTypedArray( index.type, index.array );
|
|
|
geometry.setIndex( new BufferAttribute( typedArray, 1 ) );
|
|
|
|
|
|
}
|
|
@@ -117,7 +118,7 @@ BufferGeometryLoader.prototype = Object.assign( Object.create( Loader.prototype
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- const typedArray = new TYPED_ARRAYS[ attribute.type ]( attribute.array );
|
|
|
+ const typedArray = getTypedArray( attribute.type, attribute.array );
|
|
|
const bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute;
|
|
|
bufferAttribute = new bufferAttributeConstr( typedArray, attribute.itemSize, attribute.normalized );
|
|
|
|
|
@@ -150,7 +151,7 @@ BufferGeometryLoader.prototype = Object.assign( Object.create( Loader.prototype
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- const typedArray = new TYPED_ARRAYS[ attribute.type ]( attribute.array );
|
|
|
+ const typedArray = getTypedArray( attribute.type, attribute.array );
|
|
|
bufferAttribute = new BufferAttribute( typedArray, attribute.itemSize, attribute.normalized );
|
|
|
|
|
|
}
|
|
@@ -213,17 +214,4 @@ BufferGeometryLoader.prototype = Object.assign( Object.create( Loader.prototype
|
|
|
|
|
|
} );
|
|
|
|
|
|
-const TYPED_ARRAYS = {
|
|
|
- Int8Array: Int8Array,
|
|
|
- Uint8Array: Uint8Array,
|
|
|
- // Workaround for IE11 pre KB2929437. See #11440
|
|
|
- Uint8ClampedArray: typeof Uint8ClampedArray !== 'undefined' ? Uint8ClampedArray : Uint8Array,
|
|
|
- Int16Array: Int16Array,
|
|
|
- Uint16Array: Uint16Array,
|
|
|
- Int32Array: Int32Array,
|
|
|
- Uint32Array: Uint32Array,
|
|
|
- Float32Array: Float32Array,
|
|
|
- Float64Array: Float64Array
|
|
|
-};
|
|
|
-
|
|
|
export { BufferGeometryLoader };
|