|
@@ -418,24 +418,16 @@ THREE.MTLLoader.loadTexture = function ( url, mapping, onLoad, onError ) {
|
|
|
var texture = new THREE.Texture( image, mapping );
|
|
|
|
|
|
var loader = new THREE.ImageLoader();
|
|
|
+ loader.crossOrigin = this.crossOrigin;
|
|
|
+ loader.load( url, function ( image ) {
|
|
|
|
|
|
- loader.addEventListener( 'load', function ( event ) {
|
|
|
-
|
|
|
- texture.image = THREE.MTLLoader.ensurePowerOfTwo_( event.content );
|
|
|
+ texture.image = THREE.MTLLoader.ensurePowerOfTwo_( image );
|
|
|
texture.needsUpdate = true;
|
|
|
- if ( onLoad ) onLoad( texture );
|
|
|
-
|
|
|
- } );
|
|
|
|
|
|
- loader.addEventListener( 'error', function ( event ) {
|
|
|
-
|
|
|
- if ( onError ) onError( event.message );
|
|
|
+ if ( onLoad ) onLoad( texture );
|
|
|
|
|
|
} );
|
|
|
|
|
|
- loader.crossOrigin = this.crossOrigin;
|
|
|
- loader.load( url, image );
|
|
|
-
|
|
|
}
|
|
|
|
|
|
return texture;
|