MAGE  v0.171.0
Matthias Advanced Game Engine
mage::Scene Class Reference

#include <scene.hpp>

Public Member Functions

virtual ~Scene ()
 
Sceneoperator= (const Scene &scene)=delete
 
Sceneoperator= (Scene &&scene) noexcept
 
void Initialize (Engine &engine)
 
void Uninitialize (Engine &engine)
 
ProxyPtr< NodeImport (Engine &engine, const rendering::ModelDescriptor &desc)
 
ProxyPtr< NodeImport (Engine &engine, const rendering::ModelDescriptor &desc, std::vector< ProxyPtr< Node > > &nodes)
 
template<typename ElementT , typename... ConstructorArgsT>
std::enable_if_t< std::is_same_v< Node, ElementT >, ProxyPtr< ElementT > > Create (ConstructorArgsT &&... args)
 
template<typename ElementT , typename... ConstructorArgsT>
std::enable_if_t< std::is_base_of_v< BehaviorScript, ElementT >, ProxyPtr< ElementT > > Create (ConstructorArgsT &&... args)
 
template<typename ElementT >
std::size_t GetNumberOf () const noexcept
 
template<typename ElementT , typename ActionT >
void ForEach (ActionT &&action)
 
template<typename ElementT , typename ActionT >
void ForEach (ActionT &&action) const
 
const std::string_view GetName () const noexcept
 
void SetName (std::string name) noexcept
 

Protected Member Functions

 Scene (std::string name)
 
 Scene (const Scene &scene)=delete
 
 Scene (Scene &&scene) noexcept
 

Private Member Functions

virtual void Load ([[maybe_unused]] Engine &engine)
 
virtual void Close ([[maybe_unused]] Engine &engine)
 
void Clear () noexcept
 

Private Attributes

AlignedVector< Nodem_nodes
 
AlignedVector< UniquePtr< BehaviorScript > > m_scripts
 
std::string m_name
 

Detailed Description

A class of scenes.

Constructor & Destructor Documentation

◆ ~Scene()

mage::Scene::~Scene ( )
virtualdefault

Destructs this scene.

◆ Scene() [1/3]

mage::Scene::Scene ( std::string  name)
explicitprotected

Constructs a scene.

Parameters
[in]nameThe name of the scene.

◆ Scene() [2/3]

mage::Scene::Scene ( const Scene scene)
protecteddelete

Constructs a scene from the given scene.

Parameters
[in]sceneA reference to the scene.

◆ Scene() [3/3]

mage::Scene::Scene ( Scene &&  scene)
protecteddefaultnoexcept

Constructs a scene by moving the given scene.

Parameters
[in]sceneA reference to the scene to move.

Member Function Documentation

◆ Clear()

void mage::Scene::Clear ( )
privatenoexcept

Clears this scene.

◆ Close()

void mage::Scene::Close ( [[maybe_unused] ] Engine engine)
privatevirtual

Closes this scene. Allows this scene to preform any post-processing destruction.

Parameters
[in,out]engineA reference to the engine.
Exceptions
ExceptionFailed to close this scene.

◆ Create() [1/2]

template<typename ElementT , typename... ConstructorArgsT>
std::enable_if_t< std::is_same_v< Node, ElementT >, ProxyPtr< ElementT > > mage::Scene::Create ( ConstructorArgsT &&...  args)

◆ Create() [2/2]

template<typename ElementT , typename... ConstructorArgsT>
std::enable_if_t< std::is_base_of_v< BehaviorScript, ElementT >, ProxyPtr< ElementT > > mage::Scene::Create ( ConstructorArgsT &&...  args)

◆ ForEach() [1/2]

template<typename ElementT , typename ActionT >
void mage::Scene::ForEach ( ActionT &&  action)

◆ ForEach() [2/2]

template<typename ElementT , typename ActionT >
void mage::Scene::ForEach ( ActionT &&  action) const

◆ GetName()

const std::string_view mage::Scene::GetName ( ) const
noexcept

Returns the name of this scene.

Returns
The name of this scene.

◆ GetNumberOf()

template<typename ElementT >
std::size_t mage::Scene::GetNumberOf ( ) const
noexcept

◆ Import() [1/2]

ProxyPtr< Node > mage::Scene::Import ( Engine engine,
const rendering::ModelDescriptor desc 
)

◆ Import() [2/2]

ProxyPtr< Node > mage::Scene::Import ( Engine engine,
const rendering::ModelDescriptor desc,
std::vector< ProxyPtr< Node > > &  nodes 
)

◆ Initialize()

void mage::Scene::Initialize ( Engine engine)

Initializes this scene.

Parameters
[in,out]engineA reference to the engine.
Exceptions
ExceptionFailed to initialize this scene.

◆ Load()

void mage::Scene::Load ( [[maybe_unused] ] Engine engine)
privatevirtual

Loads this scene. Allows this scene to preform any pre-processing construction.

Parameters
[in,out]engineA reference to the engine.
Exceptions
ExceptionFailed to load this scene.

◆ operator=() [1/2]

Scene& mage::Scene::operator= ( const Scene scene)
delete

Copies the given scene to this scene.

Parameters
[in]sceneA reference to the scene to copy.
Returns
A reference to the copy of the given scene (i.e. this scene).

◆ operator=() [2/2]

Scene & mage::Scene::operator= ( Scene &&  scene)
defaultnoexcept

Moves the given scene to this scene.

Parameters
[in]sceneA reference to the scene to move.
Returns
A reference to the moved scene (i.e. this scene).

◆ SetName()

void mage::Scene::SetName ( std::string  name)
noexcept

Sets the name of this scene to the given string.

Parameters
[in]nameThe name.

◆ Uninitialize()

void mage::Scene::Uninitialize ( Engine engine)

Uninitializes this scene.

Parameters
[in,out]engineA reference to the engine.
Exceptions
ExceptionFailed to unitialize this scene.

Member Data Documentation

◆ m_name

std::string mage::Scene::m_name
private

The name of this scene.

◆ m_nodes

AlignedVector< Node > mage::Scene::m_nodes
private

A vector containing the nodes of this scene.

◆ m_scripts

AlignedVector< UniquePtr< BehaviorScript > > mage::Scene::m_scripts
private

A vector containing the pointers to the scripts of this scene.