class SceneManager

Keeps track of all active SceneObjects and their components.

Keeps track of component state and triggers their events. Updates the transforms of objects as SceneObjects move.

Public

Constructors

SceneManager

SceneManager() = default

Methods

~SceneManager

~SceneManager() noexcept

OnStartUp

void OnStartUp() override

Override if you want your module to be notified once it has been constructed and started.

SetMainScene

void SetMainScene(const SPtr<SceneInstance> &scene)

In a standalone game this represents the scene that is playing.

In editor this represents the primary scene being edited. When creating scene objects and no scene is provided, the object will be created in the main scene. If null main scene is set, new empty main scene will be created internally, as the main scene must always exist.

GetMainScene

const SPtr<SceneInstance> &GetMainScene() const

GetAllScenes

const UnorderedMap<SceneInstance *, WeakSPtr<SceneInstance>> &GetAllScenes() const

Returns all live scene instances.

SetMainCameraRenderTarget

void SetMainCameraRenderTarget(const SPtr<RenderTarget> &renderTarget)

Sets the render target that the main camera in the scene (if any) will render its view to.

This generally means the main game window when running standalone, or the Game viewport when running in editor.

NotifySceneInstanceCreated

void NotifySceneInstanceCreated(const SPtr<SceneInstance> &sceneInstance)

Notifies the manager that a new scene instance was created.

NotifySceneInstanceDestroyed

void NotifySceneInstanceDestroyed(SceneInstance *sceneInstance)

Notifies the manager that a scene instance was destroyed.

staticInstance

static T &Instance()

Returns a reference to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticInstancePtr

static T *InstancePtr()

Returns a pointer to the module instance.

Module has to have been started up first otherwise an exception will be thrown.

staticShutDown

static void ShutDown()

Shuts down this module and frees any resources it is using.

staticIsStarted

static bool IsStarted()

Query if the module has been started.

Protected

Methods

~Module<T>

virtual ~Module<T>() = default

OnShutDown

virtual void OnShutDown()

Override if you want your module to be notified just before it is deleted.

staticInstanceInternal

static T *&InstanceInternal()

Returns a singleton instance of this module.

staticIsDestroyed

static bool &IsDestroyed()

Checks has the Module been shut down.

staticIsStartedUp

static bool &IsStartedUp()

Checks has the Module been started up.

Fields

mMainScene

SPtr<SceneInstance> mMainScene

mSceneInstances

UnorderedMap<SceneInstance *, WeakSPtr<SceneInstance>> mSceneInstances