SUNENGINE 0.0.2
A simple and bright C++ game engine.
 
Loading...
Searching...
No Matches
ModelManager Class Reference

Manages the loading, retrieval, and deletion of Model objects. More...

#include <ModelManager.h>

Static Public Member Functions

static Model * Get (const std::string &key)
 Retrieves a Model object by its key (private implementation).
 
static void Load (const std::string &key, const Model::PreMadeModels model)
 Loads a pre-made Model object (private implementation).
 
static void Load (const std::string &key, const std::string &path)
 Loads a Model object from a file path (private implementation).
 
static void Load (const std::string &key, int planeSize, int u, int v)
 Loads a Model object with specified parameters (private implementation).
 

Static Public Attributes

static const std::string defaultSpriteModelKey = AssetDefaults::DefaultModelSpriteKey
 Default key for sprite models.
 

Private Member Functions

 ModelManager (const ModelManager &)=delete
 
ModelManageroperator= (const ModelManager &)=delete
 
void privDelete ()
 
Model * privGet (const std::string &key)
 
void privLoad (const std::string &key, const Model::PreMadeModels model)
 
void privLoad (const std::string &key, const std::string &path)
 
void privLoad (const std::string &key, int planeSize, int u, int v)
 

Static Private Member Functions

static ModelManagerInstance ()
 
static void Delete ()
 Deletes all managed Model objects and the singleton instance.
 

Private Attributes

const std::string DefaultPath
 Default path for loading models.
 
std::map< std::string, Model * > storageMap
 Map storing Model objects associated with their keys.
 

Static Private Attributes

static ModelManagerptrInstance = nullptr
 

Friends

class ModelManagerAttorney
 

Detailed Description

Manages the loading, retrieval, and deletion of Model objects.

The ModelManager class is responsible for managing Model objects, including loading models from various sources, retrieving models by key, and deleting all managed models. It follows the Singleton design pattern.

Member Function Documentation

◆ Get()

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

Retrieves a Model object by its key (private implementation).

Parameters
keyThe key associated with the Model object.
Returns
A pointer to the Model object, or nullptr if the key is not found.
Here is the caller graph for this function:

◆ Load() [1/3]

static void ModelManager::Load ( const std::string & key,
const Model::PreMadeModels model )
inlinestatic

Loads a pre-made Model object (private implementation).

Parameters
keyThe key to associate with the Model object.
modelThe pre-made model to load.

◆ Load() [2/3]

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

Loads a Model object from a file path (private implementation).

Parameters
keyThe key to associate with the Model object.
pathThe file path to load the model from.

◆ Load() [3/3]

static void ModelManager::Load ( const std::string & key,
int planeSize,
int u,
int v )
inlinestatic

Loads a Model object with specified parameters (private implementation).

Parameters
keyThe key to associate with the Model object.
planeSizeThe size of the plane.
uThe U parameter.
vThe V parameter.

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