diff --git a/examples/webgl_loader_gltf.html b/examples/webgl_loader_gltf.html index 09ed1ad21ce75f..353a2198238753 100644 --- a/examples/webgl_loader_gltf.html +++ b/examples/webgl_loader_gltf.html @@ -52,19 +52,17 @@ // model const loader = new GLTFLoader().setPath( 'models/gltf/DamagedHelmet/glTF/' ); - loader.load( 'DamagedHelmet.gltf', function ( gltf ) { + loader.load( 'DamagedHelmet.gltf', async function ( gltf ) { // Calling compileAsync returns a promise that resolves when gltf.scene can be added // to scene without unnecessary stalling on shader compiation. This helps the page // stay responsive during startup. - renderer.compileAsync( gltf.scene, scene ).then( () => { + await renderer.compileAsync( gltf.scene, scene ); - scene.add( gltf.scene ); + scene.add( gltf.scene ); - render(); - - } ); + render(); } ); diff --git a/examples/webgl_loader_gltf_transmission.html b/examples/webgl_loader_gltf_transmission.html index d30d8196a9e272..f9f4121af95966 100644 --- a/examples/webgl_loader_gltf_transmission.html +++ b/examples/webgl_loader_gltf_transmission.html @@ -55,7 +55,7 @@ new GLTFLoader() .setPath( 'models/gltf/' ) .setDRACOLoader( new DRACOLoader().setDecoderPath( 'js/libs/draco/gltf/' ) ) - .load( 'IridescentDishWithOlives.glb', function ( gltf ) { + .load( 'IridescentDishWithOlives.glb', async function ( gltf ) { mixer = new THREE.AnimationMixer( gltf.scene ); mixer.clipAction( gltf.animations[ 0 ] ).play(); @@ -64,11 +64,9 @@ // to scene without unnecessary stalling on shader compiation. This helps the page // stay responsive during startup. - renderer.compileAsync( gltf.scene, scene ).then( () => { + await renderer.compileAsync( gltf.scene, scene ); - scene.add( gltf.scene ); - - } ); + scene.add( gltf.scene ); } );