Browse Source

MTLLoader: Removed power of 2 code (WebGLRenderer does this now).

Mr.doob 9 years ago
parent
commit
d24d7b2ab9
1 changed files with 1 additions and 33 deletions
  1. 1 33
      examples/js/loaders/MTLLoader.js

+ 1 - 33
examples/js/loaders/MTLLoader.js

@@ -418,7 +418,7 @@ THREE.MTLLoader.MaterialCreator.prototype = {
 			loader.setCrossOrigin( this.crossOrigin );
 			loader.load( url, function ( image ) {
 
-				texture.image = THREE.MTLLoader.ensurePowerOfTwo_( image );
+				texture.image = image;
 				texture.needsUpdate = true;
 
 				if ( onLoad ) onLoad( texture );
@@ -435,36 +435,4 @@ THREE.MTLLoader.MaterialCreator.prototype = {
 
 };
 
-THREE.MTLLoader.ensurePowerOfTwo_ = function ( image ) {
-
-	if ( ! THREE.Math.isPowerOfTwo( image.width ) || ! THREE.Math.isPowerOfTwo( image.height ) ) {
-
-		var canvas = document.createElement( "canvas" );
-		canvas.width = THREE.MTLLoader.nextHighestPowerOfTwo_( image.width );
-		canvas.height = THREE.MTLLoader.nextHighestPowerOfTwo_( image.height );
-
-		var ctx = canvas.getContext( "2d" );
-		ctx.drawImage( image, 0, 0, image.width, image.height, 0, 0, canvas.width, canvas.height );
-		return canvas;
-
-	}
-
-	return image;
-
-};
-
-THREE.MTLLoader.nextHighestPowerOfTwo_ = function( x ) {
-
-	-- x;
-
-	for ( var i = 1; i < 32; i <<= 1 ) {
-
-		x = x | x >> i;
-
-	}
-
-	return x + 1;
-
-};
-
 THREE.EventDispatcher.prototype.apply( THREE.MTLLoader.prototype );