![]() |
XII Release 0.1.0
|
This class allows to load a scene in the background and switch to it, once loading has finished. More...
#include <SceneLoadUtil.h>
Public Types | |
| enum class | LoadingState { NotStarted , Ongoing , FinishedSuccessfully , FinishedAndRetrieved , Failed } |
Public Member Functions | |
| LoadingState | GetLoadingState () const |
| Returns whether loading is still ongoing or finished. | |
| float | GetLoadingProgress () const |
| Returns a loading progress value in 0 to 1 range. | |
| xiiStringView | GetLoadingFailureReason () const |
| In case loading failed, this returns what went wrong. | |
| void | StartSceneLoading (xiiStringView sSceneFile, xiiStringView sPreloadCollectionFile) |
| Starts loading a scene. If provided, the assets in the collection are loaded first and then the scene is instantiated. | |
| void | TickSceneLoading () |
| This has to be called periodically (usually once per frame) to progress the scene loading. | |
| xiiUniquePtr< xiiWorld > | RetrieveLoadedScene () |
| Once loading is finished successfully, call this to take ownership of the loaded scene. | |
| xiiStringView | GetRequestedScene () const |
| Returns the path to the scene file as it was originally requested. | |
| xiiStringView | GetRedirectedScene () const |
| Returns the path to the scene file after it was redirected. | |
This class allows to load a scene in the background and switch to it, once loading has finished.
|
strong |
| Enumerator | |
|---|---|
| FinishedAndRetrieved | Loading succeeded and someone already called RetrieveLoadedScene() |
| xiiUniquePtr< xiiWorld > xiiSceneLoadUtility::RetrieveLoadedScene | ( | ) |
Once loading is finished successfully, call this to take ownership of the loaded scene.
Afterwards there is no point in keeping the xiiSceneLoadUtility around anymore and it should be deleted.
| void xiiSceneLoadUtility::StartSceneLoading | ( | xiiStringView | sSceneFile, |
| xiiStringView | sPreloadCollectionFile ) |
Starts loading a scene. If provided, the assets in the collection are loaded first and then the scene is instantiated.
Using a collection will make loading in the background much smoother. Without it, most assets will be loaded once the scene gets updated for the first time, resulting in very long delays.
| void xiiSceneLoadUtility::TickSceneLoading | ( | ) |
This has to be called periodically (usually once per frame) to progress the scene loading.
Call GetLoadingState() afterwards to check whether loading has finished or failed.