![]() |
Plasma Engine
2.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 , 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. | |
| plStringView | GetLoadingFailureReason () const |
| In case loading failed, this returns what went wrong. | |
| void | StartSceneLoading (plStringView sSceneFile, plStringView 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. | |
| plUniquePtr< plWorld > | RetrieveLoadedScene () |
| Once loading is finished successfully, call this to take ownership of the loaded scene. | |
This class allows to load a scene in the background and switch to it, once loading has finished.
| plUniquePtr< plWorld > plSceneLoadUtility::RetrieveLoadedScene | ( | ) |
Once loading is finished successfully, call this to take ownership of the loaded scene.
Afterwards there is no point in keeping the plSceneLoadUtility around anymore and it should be deleted.
| void plSceneLoadUtility::StartSceneLoading | ( | plStringView | sSceneFile, |
| plStringView | 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 plSceneLoadUtility::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.