From d95f18442ea216a886bfddf75d349362d1e537bc Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 11 Jul 2014 19:37:17 +0000 Subject: Support material layer blending. --- src/model/layer.h | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'src/model/layer.h') 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 -- cgit v1.2.3