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>2009-08-17 11:40:15 +0000
committerStijn Buys <ingar@osirion.org>2009-08-17 11:40:15 +0000
commit5636fad174f0bcff857c357c394c4cc8d424b302 (patch)
treed41807018da962a930ef087b73ce4ac89a90c6f8 /src/render
parent80aaacbaef16b4eba33428aec268f80e7466cbb1 (diff)
reload entity/info models on r_restart
Diffstat (limited to 'src/render')
-rw-r--r--src/render/render.cc26
-rw-r--r--src/render/render.h3
2 files changed, 26 insertions, 3 deletions
diff --git a/src/render/render.cc b/src/render/render.cc
index 4ad2d84..12445a6 100644
--- a/src/render/render.cc
+++ b/src/render/render.cc
@@ -130,10 +130,11 @@ void init(int width, int height)
func = core::Func::add("list_particles", func_list_particles);
func->set_info("list registered particle scripts");
+
+ load();
}
// unload game assets (zone change)
-/* TODO RenderExt class containing render state */
void unload()
{
// clear zone sky textures
@@ -165,8 +166,6 @@ void unload()
// clear all assets
void clear()
{
- //con_debug << " clearing render data...\n";
-
// clear zone sky textures
for (core::Zone::Registry::iterator it = core::Zone::registry().begin(); it != core::Zone::registry().end(); it++) {
core::Zone *zone = (*it).second;
@@ -200,6 +199,27 @@ void clear()
ParticleScript::clear();
}
+// load assets
+void load()
+{
+ // load entity models
+ for (core::Entity::Registry::iterator it = core::Entity::registry().begin(); it != core::Entity::registry().end(); it++) {
+ core::Entity *entity = (*it).second;
+
+ if (entity->modelname().size()) {
+ entity->set_model(model::Model::load(entity->modelname()));
+ }
+ }
+
+ // load info models
+ for (core::Info::Registry::iterator it = core::Info::registry().begin(); it != core::Info::registry().end(); it++) {
+ core::Info *info = (*it).second;
+ if (info->modelname().size()) {
+ model::Model::load(info->modelname());
+ }
+ }
+}
+
// reset render subsystem (module disconnect)
void reset()
{
diff --git a/src/render/render.h b/src/render/render.h
index 765e0f9..17ba42c 100644
--- a/src/render/render.h
+++ b/src/render/render.h
@@ -30,6 +30,9 @@ namespace render {
/// reset all render data
void reset();
+ /// load game render data
+ void load();
+
/// unload game render data
void unload();