webgl_materials_cubemap_mipmaps
// load mipmaps
const pendings = []; // Common practice
for ( let level = 0; level <= maxLevel; ++ level ) {
const urls = [];
for ( let face = 0; face < 6; ++ face ) {
urls.push( path + 'cube_m0' + level + '_c0' + face + format );
}
const mipmapLevel = level;
pendings.push( loadCubeTexture( urls ).then( function ( cubeTexture ) { mipmaps[ mipmapLevel ] = cubeTexture; })); }await Promise.all( pendings ); // asynchrony changes synchronization
Copy the code
webgl_tonemapping
const rgbeLoader = new RGBELoader()
.setDataType( THREE.UnsignedByteType )
.setPath( 'textures/equirectangular/' );
const gltfLoader = new GLTFLoader().setPath( 'models/gltf/DamagedHelmet/glTF/' );
const [ texture, gltf ] = await Promise.all( [
rgbeLoader.loadAsync( 'venice_sunset_1k.hdr' ),
gltfLoader.loadAsync( 'DamagedHelmet.gltf'),]);Copy the code