Browse Source

ImageUtils: Use TextureLoader in loadTexture().

Mr.doob 9 years ago
parent
commit
e8d2b08c0d
1 changed files with 5 additions and 13 deletions
  1. 5 13
      src/extras/ImageUtils.js

+ 5 - 13
src/extras/ImageUtils.js

@@ -10,24 +10,16 @@ THREE.ImageUtils = {
 
 	loadTexture: function ( url, mapping, onLoad, onError ) {
 
-		var loader = new THREE.ImageLoader();
-		loader.crossOrigin = this.crossOrigin;
-
-		var texture = new THREE.Texture( undefined, mapping );
+		var loader = new THREE.TextureLoader();
+		loader.setCrossOrigin( this.crossOrigin );
 
-		loader.load( url, function ( image ) {
-
-			texture.image = image;
-			texture.needsUpdate = true;
+		var texture = loader.load( url, function ( texture ) {
 
 			if ( onLoad ) onLoad( texture );
 
-		}, undefined, function ( event ) {
-
-			if ( onError ) onError( event );
-
-		} );
+		}, undefined, onError );
 
+		texture.mapping = mapping;
 		texture.sourceFile = url;
 
 		return texture;