Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/model')
-rw-r--r--src/model/material.cc54
-rw-r--r--src/model/material.h2
2 files changed, 53 insertions, 3 deletions
diff --git a/src/model/material.cc b/src/model/material.cc
index 2cacf42..fe596a6 100644
--- a/src/model/material.cc
+++ b/src/model/material.cc
@@ -33,10 +33,55 @@ Material::~Material()
{
}
+void Material::print()
+{
+ con_print << name() << std::endl;
+ con_print << " color: " << material_color.r << " " << material_color.g << " " << material_color.b << " " << material_color.a << std::endl;
+ con_print << " flags: " << flags() << " ";
+ if (flags() == None) {
+ con_print << "none";
+ } else {
+ if (flags() & Tertiary) {
+ con_print << "entitythird ";
+
+ } else if (flags() & Secondary) {
+ con_print << "entitysecond ";
+
+ } else if (flags() & Primary) {
+ con_print << "entity ";
+ }
+
+ if (flags() & Bright) {
+ con_print << "bright ";
+ }
+ if (flags() & Engine) {
+ con_print << "engine ";
+ }
+ if (flags() & Environment) {
+ con_print << "environment ";
+ }
+ if (flags() & Texture) {
+ con_print << "texture ";
+ }
+ if (flags() & Ignore) {
+ con_print << "ignore ";
+ }
+ if (flags() & Clip) {
+ con_print << "clip ";
+ }
+ }
+ con_print << std::endl;
+
+ if (material_texture.size()) {
+ con_print << " texture: " << material_texture << std::endl;
+ }
+
+}
+
void Material::set_color(const math::Color &color)
{
material_color.assign(color);
- material_color.a = 1.0f;
+ //material_color.a = 1.0f;
}
void Material::set_texture(const std::string &texture)
@@ -120,7 +165,7 @@ void Material::load_shader(const std::string &shadername)
unsigned int linenumber = 0;
char line[1024];
unsigned int count = 0;
- float r, g, b;
+ float r, g, b, a;
Material *material = 0;
while (shaderfile.getline(line, 1023)) {
@@ -172,7 +217,10 @@ void Material::load_shader(const std::string &shadername)
g /= 255.0f;
b /= 255.0f;
}
- material->set_color(math::Color(r, g, b, 1.0f));
+ if (!(linestream >> a)) {
+ a = 1.0f;
+ }
+ material->set_color(math::Color(r, g, b, a));
}
} else if (firstword.compare("engine") == 0) {
material->set_flags(Engine);
diff --git a/src/model/material.h b/src/model/material.h
index 3c0ccf1..9b54dcc 100644
--- a/src/model/material.h
+++ b/src/model/material.h
@@ -32,6 +32,8 @@ public:
Material(const std::string &name);
~Material();
+
+ void print();
/* ---- inspectors ----------------------------------------- */