Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2014-07-06 20:53:58 +0000
committerStijn Buys <ingar@osirion.org>2014-07-06 20:53:58 +0000
commit4d2d157ed09bb066686f83803abd90809fe20b82 (patch)
treec1cbc5a354edbf84fd3f9ed84807266924d42267 /src/model
parentc7f28c2c0c7d23712552f0cd6ea0cf462068e081 (diff)
Minor cleanups.
Diffstat (limited to 'src/model')
-rw-r--r--src/model/material.cc50
-rw-r--r--src/model/material.h5
2 files changed, 28 insertions, 27 deletions
diff --git a/src/model/material.cc b/src/model/material.cc
index 25c1f27..29bd80e 100644
--- a/src/model/material.cc
+++ b/src/model/material.cc
@@ -139,20 +139,22 @@ void Material::set_colortype(ColorType colortype)
material_colortype = colortype;
}
+/* ---- static ----------------------------------------------------- */
+
void Material::init()
{
con_print << "^BInitializing materials..." << std::endl;
- filesystem::IFileStream shaderlist("materials/shaderlist.txt");
- if (!shaderlist.is_open()) {
- con_warn << "Could not open " << shaderlist.name() << std::endl;
+ filesystem::IFileStream shaderlistfile("materials/shaderlist.txt");
+ if (!shaderlistfile.is_open()) {
+ con_warn << "Could not open " << shaderlistfile.name() << std::endl;
return;
}
- con_debug << " " << shaderlist.name() << std::endl;
+ con_debug << " " << shaderlistfile.name() << std::endl;
char line[1024];
- while (shaderlist.getline(line, 1023)) {
+ while (shaderlistfile.getline(line, 1023)) {
if ((line[0] == 0) || (line[0] == '#') || (line[0] == ';')) {
continue;
if ((line[0] == '/') && (line[1] == '/'))
@@ -160,11 +162,27 @@ void Material::init()
} else {
std::string s(line);
aux::trim(s);
- load_shader(s);
+ load_shaderfile(s);
}
}
- shaderlist.close();
+ shaderlistfile.close();
+}
+
+void Material::clear()
+{
+ con_print << "^BClearing materials..." << std::endl;
+
+ for (Registry::iterator i = material_registry.begin(); i != material_registry.end(); ++i) {
+ delete(*i).second;
+ }
+
+ material_registry.clear();
+}
+
+void Material::shutdown()
+{
+ clear();
}
void Material::add(Material *material)
@@ -174,7 +192,7 @@ void Material::add(Material *material)
}
}
-void Material::load_shader(const std::string &shadername)
+void Material::load_shaderfile(const std::string &shadername)
{
std::string shaderfilename("materials/");
shaderfilename.append(shadername);
@@ -318,22 +336,6 @@ void Material::load_shader(const std::string &shadername)
shaderfile.close();
}
-void Material::shutdown()
-{
- clear();
-}
-
-void Material::clear()
-{
- con_print << "^BClearing materials..." << std::endl;
-
- for (Registry::iterator i = material_registry.begin(); i != material_registry.end(); ++i) {
- delete(*i).second;
- }
-
- material_registry.clear();
-}
-
void Material::list()
{
for (Registry::iterator i = material_registry.begin(); i != material_registry.end(); ++i) {
diff --git a/src/model/material.h b/src/model/material.h
index 94b4418..e2a1276 100644
--- a/src/model/material.h
+++ b/src/model/material.h
@@ -69,7 +69,7 @@ public:
}
/**
- * @brief returns the material texture size
+ * @brief returns the material texture pixel size
*/
inline const math::Vector2f & size() const {
return material_size;
@@ -153,7 +153,6 @@ public:
* */
void set_colortype(ColorType colortype);
-
/**
* @brief set a specified surface flag
* @see flags()
@@ -221,7 +220,7 @@ private:
/// the materials registry
static Registry material_registry;
- static void load_shader(const std::string &shadername);
+ static void load_shaderfile(const std::string &shadername);
static LoaderFuncPtr material_loaderfunc;
};