diff --git a/examples/js/loaders/GLTFLoader.js b/examples/js/loaders/GLTFLoader.js index db67a6be605bba..4080ca027a4e8e 100644 --- a/examples/js/loaders/GLTFLoader.js +++ b/examples/js/loaders/GLTFLoader.js @@ -21,7 +21,7 @@ THREE.GLTFLoader = ( function () { constructor: GLTFLoader, - load: function ( url, onLoad, onProgress, onError ) { + load: function ( url, resolveDependencies = true, onLoad, onProgress, onError ) { var scope = this; @@ -78,7 +78,7 @@ THREE.GLTFLoader = ( function () { try { - scope.parse( data, resourcePath, function ( gltf ) { + scope.parse( data, resourcePath, resolveDependencies, function ( gltf ) { onLoad( gltf ); @@ -110,7 +110,7 @@ THREE.GLTFLoader = ( function () { }, - parse: function ( data, path, onLoad, onError ) { + parse: function ( data, path, resolveDependencies = true, onLoad, onError ) { var content; var extensions = {}; @@ -214,7 +214,17 @@ THREE.GLTFLoader = ( function () { } ); - parser.parse( onLoad, onError ); + if ( resolveDependencies ) { + + parser.parse( onLoad, onError ); + + } else { + + parser.markDefs(); + + onLoad( { parser: parser } ); + + } } diff --git a/examples/jsm/loaders/GLTFLoader.d.ts b/examples/jsm/loaders/GLTFLoader.d.ts index 0910f66ac0281b..dc44a726632bd5 100644 --- a/examples/jsm/loaders/GLTFLoader.d.ts +++ b/examples/jsm/loaders/GLTFLoader.d.ts @@ -32,10 +32,10 @@ export class GLTFLoader extends Loader { dracoLoader: DRACOLoader | null; ddsLoader: DDSLoader | null; - load( url: string, onLoad: ( gltf: GLTF ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + load( url: string, resolveDependencies: boolean, onLoad: ( gltf: GLTF ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void; setDRACOLoader( dracoLoader: DRACOLoader ): GLTFLoader; setDDSLoader( ddsLoader: DDSLoader ): GLTFLoader; - parse( data: ArrayBuffer | string, path: string, onLoad: ( gltf: GLTF ) => void, onError?: ( event: ErrorEvent ) => void ) : void; + parse( data: ArrayBuffer | string, path: string, resolveDependencies: boolean, onLoad: ( gltf: GLTF ) => void, onError?: ( event: ErrorEvent ) => void ) : void; } diff --git a/examples/jsm/loaders/GLTFLoader.js b/examples/jsm/loaders/GLTFLoader.js index 8e459e5cec0a11..699cc425cd6175 100644 --- a/examples/jsm/loaders/GLTFLoader.js +++ b/examples/jsm/loaders/GLTFLoader.js @@ -88,7 +88,7 @@ var GLTFLoader = ( function () { constructor: GLTFLoader, - load: function ( url, onLoad, onProgress, onError ) { + load: function ( url, resolveDependencies = true, onLoad, onProgress, onError ) { var scope = this; @@ -145,7 +145,7 @@ var GLTFLoader = ( function () { try { - scope.parse( data, resourcePath, function ( gltf ) { + scope.parse( data, resourcePath, resolveDependencies, function ( gltf ) { onLoad( gltf ); @@ -177,7 +177,7 @@ var GLTFLoader = ( function () { }, - parse: function ( data, path, onLoad, onError ) { + parse: function ( data, path, resolveDependencies = true, onLoad, onError ) { var content; var extensions = {}; @@ -281,7 +281,17 @@ var GLTFLoader = ( function () { } ); - parser.parse( onLoad, onError ); + if ( resolveDependencies ) { + + parser.parse( onLoad, onError ); + + } else { + + parser.markDefs(); + + onLoad( { parser: parser } ); + + } }