Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2014-07-11 19:37:17 +0000
committerStijn Buys <ingar@osirion.org>2014-07-11 19:37:17 +0000
commitd95f18442ea216a886bfddf75d349362d1e537bc (patch)
treea86352393b9f51181594ea4e167e8beba57f2f3a /src/render/state.cc
parent1d518a54914531d7a4fab3a6835b75de85bd7bc7 (diff)
Support material layer blending.
Diffstat (limited to 'src/render/state.cc')
-rw-r--r--src/render/state.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/render/state.cc b/src/render/state.cc
index 7857963..6f791b3 100644
--- a/src/render/state.cc
+++ b/src/render/state.cc
@@ -285,7 +285,7 @@ void State::use_material_layer(const model::Material * material, const model::La
gl::specular(specular);
// lighted or fullbright
- if (state_power && layer->bright()) {
+ if (state_power && layer->fullbright()) {
gl::disable(GL_LIGHTING);
} else if (state_power && (layer->rgbgen() == model::Layer::RGBGenEngine)) {
@@ -332,10 +332,26 @@ void State::use_material_layer(const model::Material * material, const model::La
}
+ // alpha blending
+ switch(layer->blendfunc()) {
+ case model::Layer::BlendFuncNone:
+ gl::disable(GL_BLEND);
+ break;
+ case model::Layer::BlendFuncAdd:
+ gl::blendfunc(GL_ONE, GL_ONE);
+ gl::enable(GL_BLEND);
+ break;
+ case model::Layer::BlendFuncBlend:
+ gl::enable(GL_BLEND);
+ break;
+ }
}
void State::reset()
{
+ gl::blendfunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ gl::enable(GL_BLEND);
+
gl::disable(GL_POLYGON_OFFSET_FILL);
gl::disable(GL_ALPHA_TEST);
gl::disable(GL_TEXTURE_GEN_S);