Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Goers <mega@osirion.org>2012-01-21 03:19:55 +0000
committerEvan Goers <mega@osirion.org>2012-01-21 03:19:55 +0000
commitd702c133c06cd9626430263292df69b092954c5f (patch)
treef0f206edef1e3c3fdddf16a63947d938cc17d86b /src/render
parent8090b641248e41334c76c5fead274f01d7d287a2 (diff)
Add a 'decal' macro material flag. Material flag 'Decal' enables polygon offsetting and alpha testing on the surface.
Diffstat (limited to 'src/render')
-rw-r--r--src/render/state.cc10
1 files changed, 10 insertions, 0 deletions
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);