X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fblend.h;h=a1180050163b31dbd009acd1987d27c8507fb5b3;hb=bae374a3cda6a1b59f36016624ef518bf2676355;hp=986844c0e6a7e1f2caa15249a8c7d8531bd4bf09;hpb=2b2676392aff2eb6b38c3e463cc67f4d67a4ef8b;p=libs%2Fgl.git diff --git a/source/core/blend.h b/source/core/blend.h index 986844c0..a1180050 100644 --- a/source/core/blend.h +++ b/source/core/blend.h @@ -4,7 +4,6 @@ #include #include #include "color.h" -#include "gl.h" namespace Msp { namespace GL { @@ -36,6 +35,16 @@ enum BlendFactor ONE_MINUS_CONSTANT_ALPHA }; +enum ColorWriteMask +{ + WRITE_NONE = 0, + WRITE_RED = 1, + WRITE_GREEN = 2, + WRITE_BLUE = 4, + WRITE_ALPHA = 8, + WRITE_ALL = 15 +}; + /** Blends incoming fragments with those already in the framebuffer. */ @@ -57,14 +66,19 @@ struct Blend BlendFactor src_factor; BlendFactor dst_factor; Color constant; + ColorWriteMask write_mask; Blend(); Blend(BlendFactor, BlendFactor); Blend(BlendEquation, BlendFactor, BlendFactor); }; -GLenum get_gl_blend_equation(BlendEquation); -GLenum get_gl_blend_factor(BlendFactor); + +inline ColorWriteMask operator|(ColorWriteMask m1, ColorWriteMask m2) +{ return static_cast(static_cast(m1)|static_cast(m2)); } + +unsigned get_gl_blend_equation(BlendEquation); +unsigned get_gl_blend_factor(BlendFactor); void operator>>(const LexicalConverter &, BlendEquation &); void operator<<(LexicalConverter &, BlendEquation); @@ -72,6 +86,9 @@ void operator<<(LexicalConverter &, BlendEquation); void operator>>(const LexicalConverter &, BlendFactor &); void operator<<(LexicalConverter &, BlendFactor); +void operator>>(const LexicalConverter &, ColorWriteMask &); +void operator<<(LexicalConverter &, ColorWriteMask); + } // namespace GL } // namespace Msp