PCG-FPS
v2 m0.22.4
Simple First Person Shooter with Procedurally Generated Level
|
Go to the documentation of this file. 1 #ifndef SKR_FPS2_RENDERER_OPENGL_MODELCACHE_H
2 #define SKR_FPS2_RENDERER_OPENGL_MODELCACHE_H
64 Model model(modelDir, scale, yoffset, shadertype);
110 assert(!m.second._path.empty());
113 if (m.second._path == path)
129 #endif // !SKR_FPS2_RENDERER_OPENGL_MODELCACHE_H
ModelCache operator=(const ModelCache &)=delete
copy assignment operator is deleted due to singleton pattern
ModelCache(const ModelCache &)=delete
copy constructor is deleted due to singleton pattern
size_t _nextModelId
id of the next model
Definition: ModelCache.h:99
manages loaded models in a central place Implements Scott Meyers' singleton pattern currently,...
Definition: ModelCache.h:22
holds information of a model
Definition: Model.h:24
std::unordered_map< size_t, Model > _modelCache
map containing models and there ids as key
Definition: ModelCache.h:96
static ModelCache & GetInstance()
gets only instance of ModelCache Implements Scott Meyers' singleton pattern
Definition: ModelCache.h:26
Model & GetModel(size_t id)
get reference to model of specified id
Definition: ModelCache.h:76
ShaderType
shader type identifies. Used as keys in map keeping shaders
Definition: Shader.h:18
bool CheckIfModelAlreadyAdded(std::string path, size_t &id)
checks if a given model is already present in the cache, based on its path
Definition: ModelCache.h:105
size_t AddModel(Model model)
add model to cache if model is already added, return its id. If not, model is added and its new id is...
Definition: ModelCache.h:36
Definition: AssetPath.h:10
std::string _path
path to directory where model file is loaded from
Definition: Model.h:29
ModelCache()
default constructor default constructor is needed since OpenGL Renderer Object is a global object,...
Definition: ModelCache.h:85
size_t AddModel(std::string modelDir, glm::vec3 scale=glm::vec3(1.0f), float yoffset=0.0f, ShaderType shadertype=ShaderType::Main)
add model to cache If model is already in cache, skip loading and return id of model....
Definition: ModelCache.h:59