Skip to content

Commit 16db861

Browse files
authored
GLTFLoader: Remove support detection for WebP and AVIF. (#30864)
1 parent df3b15e commit 16db861

File tree

1 file changed

+2
-80
lines changed

1 file changed

+2
-80
lines changed

examples/jsm/loaders/GLTFLoader.js

Lines changed: 2 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,7 +1581,6 @@ class GLTFTextureWebPExtension {
15811581

15821582
this.parser = parser;
15831583
this.name = EXTENSIONS.EXT_TEXTURE_WEBP;
1584-
this.isSupported = null;
15851584

15861585
}
15871586

@@ -1610,46 +1609,7 @@ class GLTFTextureWebPExtension {
16101609

16111610
}
16121611

1613-
return this.detectSupport().then( function ( isSupported ) {
1614-
1615-
if ( isSupported ) return parser.loadTextureImage( textureIndex, extension.source, loader );
1616-
1617-
if ( json.extensionsRequired && json.extensionsRequired.indexOf( name ) >= 0 ) {
1618-
1619-
throw new Error( 'THREE.GLTFLoader: WebP required by asset but unsupported.' );
1620-
1621-
}
1622-
1623-
// Fall back to PNG or JPEG.
1624-
return parser.loadTexture( textureIndex );
1625-
1626-
} );
1627-
1628-
}
1629-
1630-
detectSupport() {
1631-
1632-
if ( ! this.isSupported ) {
1633-
1634-
this.isSupported = new Promise( function ( resolve ) {
1635-
1636-
const image = new Image();
1637-
1638-
// Lossy test image. Support for lossy images doesn't guarantee support for all
1639-
// WebP images, unfortunately.
1640-
image.src = 'data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA';
1641-
1642-
image.onload = image.onerror = function () {
1643-
1644-
resolve( image.height === 1 );
1645-
1646-
};
1647-
1648-
} );
1649-
1650-
}
1651-
1652-
return this.isSupported;
1612+
return parser.loadTextureImage( textureIndex, extension.source, loader );
16531613

16541614
}
16551615

@@ -1668,7 +1628,6 @@ class GLTFTextureAVIFExtension {
16681628

16691629
this.parser = parser;
16701630
this.name = EXTENSIONS.EXT_TEXTURE_AVIF;
1671-
this.isSupported = null;
16721631

16731632
}
16741633

@@ -1697,44 +1656,7 @@ class GLTFTextureAVIFExtension {
16971656

16981657
}
16991658

1700-
return this.detectSupport().then( function ( isSupported ) {
1701-
1702-
if ( isSupported ) return parser.loadTextureImage( textureIndex, extension.source, loader );
1703-
1704-
if ( json.extensionsRequired && json.extensionsRequired.indexOf( name ) >= 0 ) {
1705-
1706-
throw new Error( 'THREE.GLTFLoader: AVIF required by asset but unsupported.' );
1707-
1708-
}
1709-
1710-
// Fall back to PNG or JPEG.
1711-
return parser.loadTexture( textureIndex );
1712-
1713-
} );
1714-
1715-
}
1716-
1717-
detectSupport() {
1718-
1719-
if ( ! this.isSupported ) {
1720-
1721-
this.isSupported = new Promise( function ( resolve ) {
1722-
1723-
const image = new Image();
1724-
1725-
// Lossy test image.
1726-
image.src = 'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=';
1727-
image.onload = image.onerror = function () {
1728-
1729-
resolve( image.height === 1 );
1730-
1731-
};
1732-
1733-
} );
1734-
1735-
}
1736-
1737-
return this.isSupported;
1659+
return parser.loadTextureImage( textureIndex, extension.source, loader );
17381660

17391661
}
17401662

0 commit comments

Comments
 (0)