Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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();