Description of the problem
AFAICT THREE.TextureLoader and THREE.ImageLoader don’t support CORS
THREE.TextureLoader has a setCrossOrigin
function and crossOrigin
property. When calling THREE.TextureLoader.load
a THREE.ImageLoader
is created
Object.assign( TextureLoader.prototype, {
var loader = new ImageLoader( this.manager );
loader.setCrossOrigin( this.crossOrigin );
But the cross origin setting is never used in the THREE.ImageLoader
Object.assign( ImageLoader.prototype, {
load: function ( url, onLoad, onProgress, onError ) {
var scope = this;
var image = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'img' );
image.onload = function () {
URL.revokeObjectURL( image.src );
if ( onLoad ) onLoad( image );
scope.manager.itemEnd( url );
};
if ( url.indexOf( 'data:' ) === 0 ) {
image.src = url;
Am I missing how this works?
It seems like it should be
if ( url.indexOf( 'data:' ) === 0 ) {
image.crossOrigin = this.crossOrigin; // <!===== MISSING?? =======
image.src = url;
Three.js version
- Dev
- r79
Browser
- All of them
OS
- All of them
- Windows
- Linux
- Android
- IOS
NVM