|
@@ -63,21 +63,32 @@
|
|
|
};
|
|
|
|
|
|
// Samples: sample_etc1s.ktx2, sample_uastc.ktx2, sample_uastc_zstd.ktx2
|
|
|
- new KTX2Loader()
|
|
|
+ const loader = new KTX2Loader()
|
|
|
.setTranscoderPath( 'js/libs/basis/' )
|
|
|
- .detectSupport( renderer )
|
|
|
- .load( './textures/compressed/sample_uastc_zstd.ktx2', ( texture ) => {
|
|
|
+ .detectSupport( renderer );
|
|
|
|
|
|
- console.info( `transcoded to ${formatStrings[ texture.format ]}` );
|
|
|
+ animate();
|
|
|
|
|
|
- material.map = texture;
|
|
|
- material.transparent = true;
|
|
|
+ try {
|
|
|
|
|
|
- material.needsUpdate = true;
|
|
|
+ const texture = await loader.loadAsync( './textures/compressed/sample_uastc_zstd.ktx2' );
|
|
|
|
|
|
- }, ( p ) => console.log( `...${p}` ), ( e ) => console.error( e ) );
|
|
|
+ console.info( `transcoded to ${formatStrings[ texture.format ]}` );
|
|
|
|
|
|
- animate();
|
|
|
+ material.map = texture;
|
|
|
+ material.transparent = true;
|
|
|
+
|
|
|
+ material.needsUpdate = true;
|
|
|
+
|
|
|
+ } catch ( e ) {
|
|
|
+
|
|
|
+ console.error( e );
|
|
|
+
|
|
|
+ } finally {
|
|
|
+
|
|
|
+ loader.dispose();
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
function animate() {
|
|
|
|