|
@@ -284,15 +284,15 @@ class GLTFLoader extends Loader {
|
|
|
|
|
|
parse( data, path, onLoad, onError ) {
|
|
parse( data, path, onLoad, onError ) {
|
|
|
|
|
|
- let content;
|
|
|
|
|
|
+ let json;
|
|
const extensions = {};
|
|
const extensions = {};
|
|
const plugins = {};
|
|
const plugins = {};
|
|
|
|
|
|
if ( typeof data === 'string' ) {
|
|
if ( typeof data === 'string' ) {
|
|
|
|
|
|
- content = data;
|
|
|
|
|
|
+ json = JSON.parse( data );
|
|
|
|
|
|
- } else {
|
|
|
|
|
|
+ } else if( data instanceof ArrayBuffer ) {
|
|
|
|
|
|
const magic = LoaderUtils.decodeText( new Uint8Array( data, 0, 4 ) );
|
|
const magic = LoaderUtils.decodeText( new Uint8Array( data, 0, 4 ) );
|
|
|
|
|
|
@@ -309,17 +309,19 @@ class GLTFLoader extends Loader {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- content = extensions[ EXTENSIONS.KHR_BINARY_GLTF ].content;
|
|
|
|
|
|
+ json = JSON.parse( extensions[ EXTENSIONS.KHR_BINARY_GLTF ].content );
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
- content = LoaderUtils.decodeText( new Uint8Array( data ) );
|
|
|
|
|
|
+ json = JSON.parse( LoaderUtils.decodeText( new Uint8Array( data ) ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ } else {
|
|
|
|
|
|
- const json = JSON.parse( content );
|
|
|
|
|
|
+ json = data;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
if ( json.asset === undefined || json.asset.version[ 0 ] < 2 ) {
|
|
if ( json.asset === undefined || json.asset.version[ 0 ] < 2 ) {
|
|
|
|
|