summaryrefslogtreecommitdiff
path: root/model.cpp
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2011-07-03 15:33:54 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2011-07-03 15:33:54 +0200
commit5205d99629a9b15865e7a1950b49d8da40a91309 (patch)
tree91b3deb782dac4432d48935b0566805123951d92 /model.cpp
parent75a90df8bf7f38e746e021c23248e1607931132c (diff)
Load and save terrain objects, added ModelManager for object models.HEADmaster
Diffstat (limited to 'model.cpp')
-rw-r--r--model.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/model.cpp b/model.cpp
index 67e4561..0087c05 100644
--- a/model.cpp
+++ b/model.cpp
@@ -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