@@ -1581,7 +1581,6 @@ class GLTFTextureWebPExtension {
1581
1581
1582
1582
this . parser = parser ;
1583
1583
this . name = EXTENSIONS . EXT_TEXTURE_WEBP ;
1584
- this . isSupported = null ;
1585
1584
1586
1585
}
1587
1586
@@ -1610,46 +1609,7 @@ class GLTFTextureWebPExtension {
1610
1609
1611
1610
}
1612
1611
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 ) ;
1653
1613
1654
1614
}
1655
1615
@@ -1668,7 +1628,6 @@ class GLTFTextureAVIFExtension {
1668
1628
1669
1629
this . parser = parser ;
1670
1630
this . name = EXTENSIONS . EXT_TEXTURE_AVIF ;
1671
- this . isSupported = null ;
1672
1631
1673
1632
}
1674
1633
@@ -1697,44 +1656,7 @@ class GLTFTextureAVIFExtension {
1697
1656
1698
1657
}
1699
1658
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 ) ;
1738
1660
1739
1661
}
1740
1662
0 commit comments