Sly Engine
ModelManager Class Reference

#include <ModelManager.h>

Collaboration diagram for ModelManager:
Collaboration graph

Static Public Member Functions

static Model * Get (std::string key)
 Gets a model* using the given key. More...
 
static void Load (std::string key, const char *path)
 Loads. More...
 
static void Load (std::string key, Model::PreMadeModels preFab)
 Loads. More...
 
static void LoadSpriteModel (std::string key)
 Loads the default sprite model. More...
 

Private Types

typedef std::string MapKey
 Defines an alias representing the map key. More...
 
typedef std::map< MapKey, Model * > StorageMap
 Defines an alias representing the storage map. More...
 

Private Member Functions

 ModelManager ()
 Default constructor. More...
 
 ModelManager (const ModelManager &)=delete
 Copy constructor. More...
 
 ModelManager (ModelManager &&)=delete
 Move constructor. More...
 
ModelManageroperator= (const ModelManager &)=delete
 Assignment operator. More...
 
ModelManageroperator= (ModelManager &&)=delete
 Move assignment operator. More...
 
 ~ModelManager ()=default
 Deconstructor. More...
 
void privDelete ()
 Delete's ModelManager's pointer instance. Only to be called internally. More...
 
Model * privGet (std::string key)
 Priv get. More...
 
void privLoad (std::string key, const char *path)
 Priv load. More...
 
void privLoad (std::string key, Model::PreMadeModels preFab)
 Private load. More...
 
void privLoadSpriteModel (std::string key)
 Private load sprite model. More...
 
void privInitialize ()
 Initializes the Model manager. More...
 

Static Private Member Functions

static ModelManagerInstance ()
 Gets the instance. More...
 
static void Delete ()
 Deletes ModelManager's pointer instance. Only to be called by engine code. More...
 

Private Attributes

std::string defaultPath
 The default path where Models are stored. More...
 
StorageMap modelMap
 The map containing models specified by a string key. More...
 

Static Private Attributes

static ModelManagerptrInstance = nullptr
 Pointer to ModelManager instance. More...
 

Friends

class ModelManagerAttorney
 

Member Typedef Documentation

◆ MapKey

std::string ModelManager::MapKey
private

Defines an alias representing the map key.

◆ StorageMap

std::map< MapKey, Model * > ModelManager::StorageMap
private

Defines an alias representing the storage map.

Constructor & Destructor Documentation

◆ ModelManager() [1/3]

ModelManager::ModelManager ( )
private

Default constructor.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ModelManager() [2/3]

ModelManager::ModelManager ( const ModelManager )
privatedelete

Copy constructor.

◆ ModelManager() [3/3]

ModelManager::ModelManager ( ModelManager &&  )
privatedelete

Move constructor.

◆ ~ModelManager()

ModelManager::~ModelManager ( )
privatedefault

Deconstructor.

Member Function Documentation

◆ Delete()

static void ModelManager::Delete ( )
inlinestaticprivate

Deletes ModelManager's pointer instance. Only to be called by engine code.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Get()

static Model * ModelManager::Get ( std::string  key)
inlinestatic

Gets a model* using the given key.

Parameters
keyThe key to get.
Returns
Assertion if it fails, else a pointer to a Model.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Instance()

static ModelManager & ModelManager::Instance ( )
inlinestaticprivate

Gets the instance.

Returns
A reference to ModelManager.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Load() [1/2]

static void ModelManager::Load ( std::string  key,
const char *  path 
)
inlinestatic

Loads.

Parameters
keyThe key.
pathPartial pathname of the file.
Here is the call graph for this function:

◆ Load() [2/2]

static void ModelManager::Load ( std::string  key,
Model::PreMadeModels  preFab 
)
inlinestatic

Loads.

Parameters
keyThe key.
preFabThe prefabricated model. Details in Model::PreMadeModels.
Here is the call graph for this function:

◆ LoadSpriteModel()

static void ModelManager::LoadSpriteModel ( std::string  key)
inlinestatic

Loads the default sprite model.

Parameters
keyA unique key to verify the sprite has not already been loaded.

The model manager will load the default Sprite model unit box and store this within the model map. The key is used to ensure that two sprites are not loaded under the same name.

Here is the call graph for this function:

◆ operator=() [1/2]

ModelManager& ModelManager::operator= ( const ModelManager )
privatedelete

Assignment operator.

◆ operator=() [2/2]

ModelManager& ModelManager::operator= ( ModelManager &&  )
privatedelete

Move assignment operator.

◆ privDelete()

void ModelManager::privDelete ( )
private

Delete's ModelManager's pointer instance. Only to be called internally.

Here is the caller graph for this function:

◆ privGet()

Model * ModelManager::privGet ( std::string  key)
private

Priv get.

Parameters
keyThe key.
Returns
Assertion if it fails, else a pointer to a Model.
Here is the caller graph for this function:

◆ privInitialize()

void ModelManager::privInitialize ( )
private

Initializes the Model manager.

Takes care of asset loading that needs to occur outside of the constructor

◆ privLoad() [1/2]

void ModelManager::privLoad ( std::string  key,
const char *  path 
)
private

Priv load.

Parameters
keyThe key.
pathPartial pathname of the file.
Here is the caller graph for this function:

◆ privLoad() [2/2]

void ModelManager::privLoad ( std::string  key,
Model::PreMadeModels  preFab 
)
private

Private load.

Parameters
keyThe key.
preFabThe prefabricated model.

There are three premade models offered by the Model manager. Their keys are: UnitSquareXY UnitBox_WF and UnitSphere

◆ privLoadSpriteModel()

void ModelManager::privLoadSpriteModel ( std::string  key)
private

Private load sprite model.

Parameters
keyThe unique key.

Internal process for loading the sprite box. Checks to ensure the sprite does not already exist and if not, loads the box into the map under the specified key.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ ModelManagerAttorney

friend class ModelManagerAttorney
friend

Member Data Documentation

◆ defaultPath

std::string ModelManager::defaultPath
private

The default path where Models are stored.

◆ modelMap

StorageMap ModelManager::modelMap
private

The map containing models specified by a string key.

◆ ptrInstance

ModelManager * ModelManager::ptrInstance = nullptr
staticprivate

Pointer to ModelManager instance.


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