2
0
Mr.doob 9 жил өмнө
parent
commit
6cec110479

+ 2 - 4
src/loaders/TextureLoader.js

@@ -20,10 +20,8 @@ Object.assign( THREE.TextureLoader.prototype, {
 		loader.load( url, function ( image ) {
 
 			// JPEGs can't have an alpha channel, so memory can be saved by storing them as RGB.
-			var isJPEG = url.search(/\.(jpg|jpeg)$/) > 0;
-			if (!isJPEG) {
-				isJPEG = url.search(/^data\:image\/jpeg/) == 0;
-			}
+			var isJPEG = url.search( /\.(jpg|jpeg)$/ ) > 0 || url.search( /^data\:image\/jpeg/ ) === 0;
+
 			texture.format = isJPEG ? THREE.RGBFormat : THREE.RGBAFormat;
 			texture.image = image;
 			texture.needsUpdate = true;