Skip to content

Commit 9cff15c

Browse files
committed
Updated builds.
1 parent 1eb3ffc commit 9cff15c

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

build/three.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23910,7 +23910,7 @@ THREE.WebGLRenderer = function ( parameters ) {
2391023910
}
2391123911

2391223912
var image = texture.image,
23913-
isImagePowerOfTwo = isPowerOfTwo( image ), // TODO: Always true at this step?
23913+
isImagePowerOfTwo = isPowerOfTwo( image ),
2391423914
glFormat = paramThreeToGL( texture.format ),
2391523915
glType = paramThreeToGL( texture.type );
2391623916

@@ -24077,16 +24077,22 @@ THREE.WebGLRenderer = function ( parameters ) {
2407724077

2407824078
function makePowerOfTwo( image ) {
2407924079

24080-
var canvas = document.createElement( 'canvas' );
24081-
canvas.width = THREE.Math.nearestPowerOfTwo( image.width );
24082-
canvas.height = THREE.Math.nearestPowerOfTwo( image.height );
24080+
if ( image instanceof HTMLImageElement || image instanceof HTMLCanvasElement ) {
2408324081

24084-
var context = canvas.getContext( '2d' );
24085-
context.drawImage( image, 0, 0, canvas.width, canvas.height );
24082+
var canvas = document.createElement( 'canvas' );
24083+
canvas.width = THREE.Math.nearestPowerOfTwo( image.width );
24084+
canvas.height = THREE.Math.nearestPowerOfTwo( image.height );
24085+
24086+
var context = canvas.getContext( '2d' );
24087+
context.drawImage( image, 0, 0, canvas.width, canvas.height );
2408624088

24087-
console.warn( 'THREE.WebGLRenderer: image is not power of two (' + image.width + 'x' + image.height + '). Resized to ' + canvas.width + 'x' + canvas.height, image );
24089+
console.warn( 'THREE.WebGLRenderer: image is not power of two (' + image.width + 'x' + image.height + '). Resized to ' + canvas.width + 'x' + canvas.height, image );
2408824090

24089-
return canvas;
24091+
return canvas;
24092+
24093+
}
24094+
24095+
return image;
2409024096

2409124097
}
2409224098

build/three.min.js

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)