* Load a scene resources without parsing them. * * When another scene resources are loading in background, it waits for * all its resources to be loaded before loading resources of the given * scene.
(
sceneName: string,
onProgress?: (count: number, total: number) => void
)
| 404 | * scene. |
| 405 | */ |
| 406 | async loadSceneResources( |
| 407 | sceneName: string, |
| 408 | onProgress?: (count: number, total: number) => void |
| 409 | ): Promise<void> { |
| 410 | debugLogger.log( |
| 411 | `Prioritization of loading of resources for scene ${sceneName} was requested.` |
| 412 | ); |
| 413 | |
| 414 | this.sceneResourceLoadingQueue.isLoadingInForeground = true; |
| 415 | const task = this.sceneResourceLoadingQueue.prioritize(sceneName); |
| 416 | return new Promise<void>((resolve, reject) => { |
| 417 | if (!task) { |
| 418 | this.sceneResourceLoadingQueue.isLoadingInForeground = false; |
| 419 | debugLogger.log( |
| 420 | `Loading of resources for scene ${sceneName} was immediately resolved.` |
| 421 | ); |
| 422 | resolve(); |
| 423 | return; |
| 424 | } |
| 425 | task.registerCallback(() => { |
| 426 | debugLogger.log( |
| 427 | `Loading of resources for scene ${sceneName} just finished.` |
| 428 | ); |
| 429 | this.sceneResourceLoadingQueue.isLoadingInForeground = false; |
| 430 | resolve(); |
| 431 | }, onProgress); |
| 432 | }); |
| 433 | } |
| 434 | |
| 435 | /** |
| 436 | * Preload an object assets in background. |
no test coverage detected