Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2010-11-17 23:37:52 +0000
committerStijn Buys <ingar@osirion.org>2010-11-17 23:37:52 +0000
commit9f1c9694199969e1cd1fb9bf731d0e8ef2d8c184 (patch)
tree8d8b603680db00b628e7d8b916b4a1e4d3c03e90 /src/render/render.cc
parentee017172af06f4b247038510e5ef7f8ac3596f66 (diff)
Removed core::Info.model(), info record models must be referenced through Info::modelname().
Prevent the loading of all info record models in render::load(). Added r_loadmodels engine function, which can be used to load all referenced models at once.
Diffstat (limited to 'src/render/render.cc')
-rw-r--r--src/render/render.cc24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/render/render.cc b/src/render/render.cc
index 1b0d90e..2a325e9 100644
--- a/src/render/render.cc
+++ b/src/render/render.cc
@@ -60,6 +60,11 @@ void func_list_particles(std::string const &args)
ParticleScript::list();
}
+void func_load_info_models(std::string const &args)
+{
+ load_info_models();
+}
+
void init(int width, int height)
{
con_print << "^BInitializing renderer..." << std::endl;
@@ -148,6 +153,9 @@ void init(int width, int height)
func = core::Func::add("list_particles", func_list_particles);
func->set_info("list registered particle scripts");
+
+ func = core::Func::add("r_loadmodels", func_load_info_models);
+ func->set_info("load all models referenced by info record");
load();
}
@@ -198,12 +206,6 @@ void clear()
}
}
- // clear info models
- for (core::Info::Registry::iterator it = core::Info::registry().begin(); it != core::Info::registry().end(); it++) {
- core::Info *info = (*it);
- info->set_model(0);
- }
-
// clear model registry
model::Model::clear();
@@ -225,16 +227,19 @@ void load()
entity->set_model(model::Model::load(entity->modelname()));
}
}
+}
+// load all models referenced by info records
+void load_info_models()
+{
// load info models
for (core::Info::Registry::iterator it = core::Info::registry().begin(); it != core::Info::registry().end(); it++) {
core::Info *info = (*it);
if (info->modelname().size()) {
- info->set_model(model::Model::load(info->modelname()));
- } else {
- info->set_model(0);
+ model::Model::load(info->modelname());
}
}
+
}
// reset render subsystem (module disconnect)
@@ -265,6 +270,7 @@ void shutdown()
core::Func::remove("list_materials");
core::Func::remove("list_particles");
core::Func::remove("list_textures");
+ core::Func::remove("r_loadmodels");
clear();