Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/model/material.cc9
-rw-r--r--src/model/material.h2
-rw-r--r--src/render/state.cc10
3 files changed, 18 insertions, 3 deletions
diff --git a/src/model/material.cc b/src/model/material.cc
index 56bb3fc..b76be02 100644
--- a/src/model/material.cc
+++ b/src/model/material.cc
@@ -50,7 +50,7 @@ void Material::print()
} else if (flags() & Primary) {
con_print << "entity ";
}
-
+
if (flags() & Bright) {
con_print << "bright ";
}
@@ -71,7 +71,10 @@ void Material::print()
}
if (flags() & Origin) {
con_print << "origin ";
- }
+ }
+ if (flags() & Decal) {
+ con_print << "decal ";
+ }
}
con_print << std::endl;
@@ -243,6 +246,8 @@ void Material::load_shader(const std::string &shadername)
material->set_flags(Clip);
} else if (firstword.compare("origin") == 0) {
material->set_flags(Origin);
+ } else if (firstword.compare("decal") == 0) {
+ material->set_flags(Decal);
} else if (firstword.compare("qer_editorimage") == 0) {
// keyword qer_editorimage is ignored
continue;
diff --git a/src/model/material.h b/src/model/material.h
index 1674e46..b128954 100644
--- a/src/model/material.h
+++ b/src/model/material.h
@@ -24,7 +24,7 @@ public:
typedef void(* LoaderFuncPtr)(Material *);
/// surface flags
- enum SurfaceFlags { None = 0, Primary = 1, Secondary = 2, Tertiary = 3, Bright = 4, Engine = 8, Environment = 16, Texture = 32, Ignore = 64, Clip = 128, Origin = 256};
+ enum SurfaceFlags { None = 0, Primary = 1, Secondary = 2, Tertiary = 3, Bright = 4, Engine = 8, Environment = 16, Texture = 32, Ignore = 64, Clip = 128, Origin = 256, Decal = 512 };
/// type definition for the material registry
typedef std::map<std::string, Material *> Registry;
diff --git a/src/render/state.cc b/src/render/state.cc
index 09e1a59..ffff7e3 100644
--- a/src/render/state.cc
+++ b/src/render/state.cc
@@ -219,6 +219,14 @@ void State::use_material(const model::Material * material) {
gl::color(color);
return;
}
+
+ // Decal macro
+ if (material->flags() & model::Material::Decal) {
+ gl::enable(GL_POLYGON_OFFSET_FILL);
+ gl::enable(GL_ALPHA_TEST);
+ glPolygonOffset(-1,-1);
+ glAlphaFunc(GL_GEQUAL, 0.5f);
+ }
// assign the opengl drawing color according to material flags
if (material->flags() & model::Material::Engine) {
@@ -312,6 +320,8 @@ void State::use_material(const model::Material * material) {
}
void State::reset() {
+ gl::disable(GL_POLYGON_OFFSET_FILL);
+ gl::disable(GL_ALPHA_TEST);
gl::disable(GL_TEXTURE_GEN_S);
gl::disable(GL_TEXTURE_GEN_T);
gl::disable(GL_TEXTURE_GEN_R);