|
@@ -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;
|