diff options
Diffstat (limited to 'model.cpp')
-rw-r--r-- | model.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -101,4 +101,27 @@ void Tree::render() { leaves->render(); } +/* ModelManager */ + +ModelManager *ModelManager::model_mgr = NULL; + +void ModelManager::add_model(const std::string name, Model::p model) { + models.insert(std::pair<const std::string, Model::p>(name, model)); +} + +Model::p ModelManager::get_model(const std::string name) { + std::map<const std::string, Model::p>::iterator it = models.find(name); + if(it != models.end()) + return it->second; + + return Model::p(); +} + +ModelManager& ModelManager::get_instance() { + if(!model_mgr) + model_mgr = new ModelManager(); + + return *model_mgr; +} + } // namespace models |