From c8a6ff1c0693ca1bd9025dcbdd7c22e3d193f8dd Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 8 Feb 2009 13:13:11 +0000 Subject: materials registry, read shaderlist.txt --- src/render/render.cc | 26 +++++++++++++++++++++++--- src/render/screenshot.cc | 2 +- 2 files changed, 24 insertions(+), 4 deletions(-) (limited to 'src/render') diff --git a/src/render/render.cc b/src/render/render.cc index 41aa96f..fbeec11 100644 --- a/src/render/render.cc +++ b/src/render/render.cc @@ -14,6 +14,8 @@ #include "core/gameinterface.h" #include "filesystem/filesystem.h" #include "model/model.h" +#include "model/material.h" +#include "model/material.h" #include "render/gl.h" #include "render/state.h" #include "render/dust.h" @@ -39,6 +41,11 @@ void func_list_textures(std::string const &args) Textures::list(); } +void func_list_materials(std::string const &args) +{ + model::Material::list(); +} + void func_list_particles(std::string const &args) { ParticleScript::list(); @@ -63,6 +70,9 @@ void init(int width, int height) Dust::init(); + // read materials + model::Material::init(); + // size of the vertex array in megabytes r_arraysize = core::Cvar::get("r_arraysize", 0.0f , core::Cvar::Archive); r_arraysize->set_info("[int] size of the vertex array in Mb"); @@ -102,10 +112,14 @@ void init(int width, int height) // engine functions core::Func *func = core::Func::add("list_textures", func_list_textures); - func->set_info("list loaded textures"); + func->set_info("list registered textures"); + + func = core::Func::add("list_materials", func_list_materials); + func->set_info("list registered materials"); + func = core::Func::add("list_particles", func_list_particles); - func->set_info("list loaded particle scripts"); + func->set_info("list registered particle scripts"); } // unload game assets (zone change) @@ -166,9 +180,12 @@ void clear() } } - // clear model refistry + // clear model registry model::Model::clear(); + // clear materials + model::Material::clear(); + // clear particle system scripts ParticleScript::clear(); @@ -197,6 +214,8 @@ void reset() vertexarray = new model::VertexArray(mb); Dust::reset(); + + model::Material::init(); } void resize(int width, int height) @@ -208,6 +227,7 @@ void shutdown() { con_print << "^BShutting down renderer..." << std::endl; + core::Func::remove("list_materials"); core::Func::remove("list_particles"); core::Func::remove("list_textures"); diff --git a/src/render/screenshot.cc b/src/render/screenshot.cc index aa5aa9e..043756b 100644 --- a/src/render/screenshot.cc +++ b/src/render/screenshot.cc @@ -35,7 +35,7 @@ void Screenshot::save() // make sure the screenshots folder exists filename.assign(filesystem::writedir()); filename.append("screenshots"); - if (!sys::isdirectory(filename)) { + if (!sys::directory_exists(filename)) { sys::mkdir(filename); } filename += '/'; -- cgit v1.2.3