diff --git a/src/extras/ImageUtils.js b/src/extras/ImageUtils.js index 1a8faea486596be7668d54aa7e6451ebee785892..8d64500b644751587e76cd41eaa4c61615b4c741 100644 --- a/src/extras/ImageUtils.js +++ b/src/extras/ImageUtils.js @@ -20,48 +20,23 @@ THREE.ImageUtils = { }, undefined, onError ); texture.mapping = mapping; - texture.sourceFile = url; return texture; }, - loadTextureCube: function ( array, mapping, onLoad, onError ) { + loadTextureCube: function ( urls, mapping, onLoad, onError ) { - var images = []; - - var loader = new THREE.ImageLoader(); - loader.crossOrigin = this.crossOrigin; - - var texture = new THREE.CubeTexture( images, mapping ); - - var loaded = 0; - - function loadTexture( i ) { - - loader.load( array[ i ], function ( image ) { - - texture.images[ i ] = image; - - loaded += 1; - - if ( loaded === 6 ) { - - texture.needsUpdate = true; - - if ( onLoad ) onLoad( texture ); - - } - - }, undefined, onError ); + var loader = new THREE.CubeTextureLoader(); + loader.setCrossOrigin( this.crossOrigin ); - } + var texture = loader.load( urls, function ( texture ) { - for ( var i = 0, il = array.length; i < il; ++ i ) { + if ( onLoad ) onLoad( texture ); - loadTexture( i ); + }, undefined, onError ); - } + texture.mapping = mapping; return texture; diff --git a/src/loaders/TextureLoader.js b/src/loaders/TextureLoader.js index dd01275e5be73708ceebfa5306c011d882b077ff..171a2461bf1dcc6ad017ac3515af9a1a8d5b9b2a 100644 --- a/src/loaders/TextureLoader.js +++ b/src/loaders/TextureLoader.js @@ -14,11 +14,9 @@ THREE.TextureLoader.prototype = { load: function ( url, onLoad, onProgress, onError ) { - var scope = this; - var texture = new THREE.Texture(); - var loader = new THREE.ImageLoader( scope.manager ); + var loader = new THREE.ImageLoader( this.manager ); loader.setCrossOrigin( this.crossOrigin ); loader.load( url, function ( image ) {