Browse Source

Moved MTLLoader.MaterialCreator.loadTexture to inside the prototype definition.

Mr.doob 12 years ago
parent
commit
bcf7a73b50
1 changed files with 19 additions and 18 deletions
  1. 19 18
      examples/js/loaders/MTLLoader.js

+ 19 - 18
examples/js/loaders/MTLLoader.js

@@ -401,37 +401,38 @@ THREE.MTLLoader.MaterialCreator.prototype = {
 		this.materials[ materialName ] = new THREE.MeshPhongMaterial( params );
 		return this.materials[ materialName ];
 
-	}
+	},
 
-};
 
-THREE.MTLLoader.MaterialCreator.prototype.loadTexture = function ( url, mapping, onLoad, onError ) {
+	loadTexture: function ( url, mapping, onLoad, onError ) {
 
-	var isCompressed = /\.dds$/i.test( url );
+		var isCompressed = /\.dds$/i.test( url );
 
-	if ( isCompressed ) {
+		if ( isCompressed ) {
 
-		var texture = THREE.ImageUtils.loadCompressedTexture( url, mapping, onLoad, onError );
+			var texture = THREE.ImageUtils.loadCompressedTexture( url, mapping, onLoad, onError );
 
-	} else {
+		} else {
 
-		var image = new Image();
-		var texture = new THREE.Texture( image, mapping );
+			var image = new Image();
+			var texture = new THREE.Texture( image, mapping );
 
-		var loader = new THREE.ImageLoader();
-		loader.crossOrigin = this.crossOrigin;
-		loader.load( url, function ( image ) {
+			var loader = new THREE.ImageLoader();
+			loader.crossOrigin = this.crossOrigin;
+			loader.load( url, function ( image ) {
 
-			texture.image = THREE.MTLLoader.ensurePowerOfTwo_( image );
-			texture.needsUpdate = true;
+				texture.image = THREE.MTLLoader.ensurePowerOfTwo_( image );
+				texture.needsUpdate = true;
 
-			if ( onLoad ) onLoad( texture );
+				if ( onLoad ) onLoad( texture );
 
-		} );
+			} );
 
-	}
+		}
+
+		return texture;
 
-	return texture;
+	}
 
 };