|
356 | 356 | height: 50vh; |
357 | 357 | top: 50vh; |
358 | 358 | left: 25vw; |
359 | | - padding: 10px; |
| 359 | + padding: 5px; |
360 | 360 | border: none; |
361 | 361 | } |
362 | 362 |
|
|
371 | 371 | height: 50vh; |
372 | 372 | top: 50vh; |
373 | 373 | left: 25vw; |
374 | | - padding: 10px; |
| 374 | + padding: 5px; |
375 | 375 | border: none; |
376 | 376 | } |
377 | 377 |
|
|
3193 | 3193 | } |
3194 | 3194 | } |
3195 | 3195 |
|
3196 | | - function load_with_assimp( fetched_files = null, from_url = false ) { |
| 3196 | + async function load_with_assimp( fetched_files = null, from_url = false ) { |
3197 | 3197 | if (fetched_files === null) return; |
3198 | 3198 |
|
3199 | 3199 | assimp_load = true; |
3200 | 3200 |
|
3201 | 3201 | // Use ASSIMPJS to load files - some models might take time to load |
3202 | | - assimpjs().then( async function( ajs ) { |
| 3202 | + await assimpjs().then( async function( ajs ) { |
3203 | 3203 | if (from_url === true) { |
3204 | 3204 | Promise.all( assimp_files.map( ( file, index ) => fetch( fetched_files[ index ] ) )).then( ( responses ) => { |
3205 | 3205 | return Promise.all( responses.map( ( res ) => res.arrayBuffer() ) ); |
|
3263 | 3263 | result = null; |
3264 | 3264 | resultFile = null; |
3265 | 3265 |
|
3266 | | - load_components( false ); |
| 3266 | + load_components( from_url ); |
3267 | 3267 | } |
3268 | 3268 | }); |
3269 | 3269 | } |
|
3392 | 3392 | // Load DRACO or gltf file |
3393 | 3393 | if (selected_gltf_file !== null) loadFile(); |
3394 | 3394 | else if (selected_draco_file !== null) loadDRACO(); |
| 3395 | + } else { |
| 3396 | + if (assimp_load === true && selected_gltf_file !== null) loadFile(); |
3395 | 3397 | } |
3396 | 3398 | } |
3397 | 3399 |
|
|
3704 | 3706 | } |
3705 | 3707 |
|
3706 | 3708 | function loadFile() { |
3707 | | - let lfile = local_files[ selected_gltf_file ]; |
| 3709 | + let lfile = local_files ? local_files[ selected_gltf_file ] : ( assimp_load === true ? selected_gltf_file : null ); |
3708 | 3710 |
|
3709 | | - gltf_loader.load( URL.createObjectURL( assimp_load === true ? selected_gltf_file : lfile ), async function( gltf ) { |
| 3711 | + gltf_loader.load( URL.createObjectURL( lfile ), async function( gltf ) { |
3710 | 3712 | URL.revokeObjectURL( assimp_load === true ? selected_gltf_file : lfile ); |
3711 | 3713 |
|
3712 | 3714 | parser = gltf.parser; |
|
4059 | 4061 | handle_error( error ); |
4060 | 4062 | }); |
4061 | 4063 | } else { |
4062 | | - gltf_loader.load( selected_gltf_url_file, async function( gltf ) { |
| 4064 | + gltf_loader.load( selected_gltf_url_file ? selected_gltf_url_file : selected_gltf_file, async function( gltf ) { |
4063 | 4065 | parser = gltf.parser; |
4064 | 4066 | scenes = gltf.scenes; |
4065 | 4067 | cameras = gltf.cameras; |
|
0 commit comments