X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fblend.h;h=874230c682c9ccf82e21c88a644f1dc61aa6034d;hb=cdefdb4b0f94613c2b41757fb33ae155efa9a205;hp=da7c8c7f266b1d08a26b95fc525a73fb1940336a;hpb=190a7e11237351f6b730c28f7b16f183e8adc69c;p=libs%2Fgl.git diff --git a/source/core/blend.h b/source/core/blend.h index da7c8c7f..874230c6 100644 --- a/source/core/blend.h +++ b/source/core/blend.h @@ -8,7 +8,7 @@ namespace Msp { namespace GL { -enum BlendEquation +enum BlendEquation: std::uint8_t { ADD, SUBTRACT, @@ -17,7 +17,7 @@ enum BlendEquation MAX }; -enum BlendFactor +enum BlendFactor: std::uint8_t { ZERO, ONE, @@ -35,7 +35,7 @@ enum BlendFactor ONE_MINUS_CONSTANT_ALPHA }; -enum ColorWriteMask +enum ColorWriteMask: std::uint8_t { WRITE_NONE = 0, WRITE_RED = 1, @@ -67,12 +67,23 @@ struct Blend BlendFactor dst_factor = ZERO; Color constant = { 0.0f, 0.0f, 0.0f, 0.0f }; ColorWriteMask write_mask = WRITE_ALL; + bool alpha_to_coverage = false; Blend() = default; Blend(BlendFactor, BlendFactor); Blend(BlendEquation, BlendFactor, BlendFactor); + + bool operator==(const Blend &) const; + bool operator!=(const Blend &b) const { return !operator==(b); } }; +inline bool Blend::operator==(const Blend &other) const +{ + return enabled==other.enabled && equation==other.equation && src_factor==other.src_factor && + dst_factor==other.dst_factor && constant==other.constant && write_mask==other.write_mask && + alpha_to_coverage==other.alpha_to_coverage; +} + inline ColorWriteMask operator|(ColorWriteMask m1, ColorWriteMask m2) { return static_cast(static_cast(m1)|static_cast(m2)); }