Plasma Engine  2.0
Loading...
Searching...
No Matches
plSceneLoadUtility 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 , 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< plWorldRetrieveLoadedScene ()
 Once loading is finished successfully, call this to take ownership of the loaded scene.
 

Detailed Description

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

Member Function Documentation

◆ RetrieveLoadedScene()

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.

◆ StartSceneLoading()

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.

◆ TickSceneLoading()

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.


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