- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 36.1k
Description
Description of the problem
I am trying to load a .glb file from a remote server. The .glb file references an external texture file that also lives on the server.
I can successfully load the .glb file from the remote server with:
const loader = new GLTFLoader(manager);
loader.setCrossOrigin('use-credentials');
but I am running into CORS issues when GLTFLoader is trying to  load the texture image.
It seems like GLTFLoader is using ImageBitmapLoader but ImageBitmapLoader is using fetch but not passing any options to properly set the credentials option:
three.js/src/loaders/ImageBitmapLoader.js
Lines 66 to 89 in 2299282
| fetch( url ).then( function ( res ) { | |
| return res.blob(); | |
| } ).then( function ( blob ) { | |
| return createImageBitmap( blob, scope.options ); | |
| } ).then( function ( imageBitmap ) { | |
| Cache.add( url, imageBitmap ); | |
| if ( onLoad ) onLoad( imageBitmap ); | |
| scope.manager.itemEnd( url ); | |
| } ).catch( function ( e ) { | |
| if ( onError ) onError( e ); | |
| scope.manager.itemError( url ); | |
| scope.manager.itemEnd( url ); | |
| } ); | 
I've also noticed this in STLLoader and I'm currently not sure how many other Loaders have a similar issue:
three.js/examples/jsm/loaders/STLLoader.js
Lines 76 to 80 in 2299282
| var loader = new FileLoader( scope.manager ); | |
| loader.setPath( scope.path ); | |
| loader.setResponseType( 'arraybuffer' ); | |
| loader.setRequestHeader( this.requestHeader ); | |
| loader.load( url, function ( text ) { | 
Also I'm noticing that some loaders will include an extra withCredentials member variable when Loaders already has crossOrigin which makes it a little confusing for me to know which one to set. (See FileLoader)
Three.js version
- Dev
Browser
- Chrome
OS
- macOS