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/model/layer.h
parent1d518a54914531d7a4fab3a6835b75de85bd7bc7 (diff)
Support material layer blending.
Diffstat (limited to 'src/model/layer.h')
-rw-r--r--src/model/layer.h36
1 files changed, 28 insertions, 8 deletions
diff --git a/src/model/layer.h b/src/model/layer.h
index 5cc7d2b..d6af529 100644
--- a/src/model/layer.h
+++ b/src/model/layer.h
@@ -47,6 +47,15 @@ public:
TCGenBase = 1, // use texture coordinates from vertex array
TCGenEnvironment = 2 // texture coordinates generated by GL_SPHERE_MAP/GL_REFLECTION_MAP
};
+
+ /**
+ * @brief blend functions definition
+ * */
+ enum BlendFunc {
+ BlendFuncNone = 0, // no blending
+ BlendFuncAdd = 1, // GL_ONE GL_OME
+ BlendFuncBlend = 2 // GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
+ };
/**
* @brief default constructor
@@ -130,9 +139,17 @@ public:
/**
* @brief returns true if lighting calculations should be disabled for this layer
* */
- inline const bool bright() const
+ inline const bool fullbright() const
+ {
+ return layer_fullbright;
+ }
+
+ /**
+ * @brief returns the current alpha blending function
+ * */
+ inline const BlendFunc blendfunc() const
{
- return layer_bright;
+ return layer_blendfunc;
}
/* ---- mutators ------------------------------------------- */
@@ -153,7 +170,6 @@ public:
* */
void set_specular(const math::Color & specular);
-
/**
* @brief set the texture map type
* */
@@ -178,26 +194,30 @@ public:
* @brief enable or disable lighting calculations on this layer
* If set to true, lighting is disabled.
* */
- void set_bright(const bool bright);
+ void set_fullbright(const bool fullbright);
/**
* @brief set the layer size, in pixels
* */
void set_size(const math::Vector2f & size);
+
+ /**
+ * @brief set alpha blending function
+ * */
+ void set_blendfunc(const BlendFunc blendfunc);
private:
math::Vector2f layer_size;
RGBGen layer_rgbgen;
math::Color layer_color;
- math::Color layer_color_specular;
-
+ math::Color layer_color_specular;
TexMap layer_texmap;
std::string layer_texture_name;
size_t layer_texture_id;
-
TCGen layer_tcgen;
+ bool layer_fullbright;
+ BlendFunc layer_blendfunc;
- bool layer_bright;
};
} // namespace model