XII Release 0.1.0
Loading...
Searching...
No Matches
xiiSceneLoadUtility Class Reference

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< xiiWorldRetrieveLoadedScene ()
 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.
 

Detailed Description

This class allows to load a scene in the background and switch to it, once loading has finished.

Member Enumeration Documentation

◆ LoadingState

Enumerator
FinishedAndRetrieved 

Loading succeeded and someone already called RetrieveLoadedScene()

Member Function Documentation

◆ 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.

◆ StartSceneLoading()

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.

◆ TickSceneLoading()

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.


The documentation for this class was generated from the following files: