X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fblend.cpp;h=2923cb452217351a9a2f3da1f685ed29dc0cd053;hb=cdefdb4b0f94613c2b41757fb33ae155efa9a205;hp=8ceb23829a76894e978dfad03a1531c3421c215e;hpb=bae374a3cda6a1b59f36016624ef518bf2676355;p=libs%2Fgl.git diff --git a/source/core/blend.cpp b/source/core/blend.cpp index 8ceb2382..2923cb45 100644 --- a/source/core/blend.cpp +++ b/source/core/blend.cpp @@ -1,5 +1,3 @@ -#include -#include #include #include #include "blend.h" @@ -9,37 +7,24 @@ using namespace std; namespace Msp { namespace GL { -Blend::Blend(): - enabled(false), - equation(ADD), - src_factor(ONE), - dst_factor(ZERO), - constant(0.0f, 0.0f, 0.0f, 0.0f), - write_mask(WRITE_ALL) -{ } - Blend::Blend(BlendFactor sf, BlendFactor df): enabled(true), - equation(ADD), src_factor(sf), - dst_factor(df), - constant(0.0f, 0.0f, 0.0f, 0.0f), - write_mask(WRITE_ALL) + dst_factor(df) { } Blend::Blend(BlendEquation e, BlendFactor sf, BlendFactor df): enabled(true), equation(e), src_factor(sf), - dst_factor(df), - constant(0.0f, 0.0f, 0.0f, 0.0f), - write_mask(WRITE_ALL) + dst_factor(df) { } Blend::Loader::Loader(Blend &b): ObjectLoader(b) { + add("alpha_to_coverage", &Blend::alpha_to_coverage); add("equation", &Loader::equation); add("factors", &Loader::factors); add("constant", &Loader::constant); @@ -64,41 +49,6 @@ void Blend::Loader::factors(BlendFactor sf, BlendFactor df) } -unsigned get_gl_blend_equation(BlendEquation eq) -{ - switch(eq) - { - case ADD: return GL_FUNC_ADD; - case SUBTRACT: return GL_FUNC_SUBTRACT; - case REVERSE_SUBTRACT: return GL_FUNC_REVERSE_SUBTRACT; - case MIN: return GL_MIN; - case MAX: return GL_MAX; - default: throw invalid_argument("get_gl_blend_equation"); - } -} - -unsigned get_gl_blend_factor(BlendFactor factor) -{ - switch(factor) - { - case ZERO: return GL_ZERO; - case ONE: return GL_ONE; - case SRC_COLOR: return GL_SRC_COLOR; - case ONE_MINUS_SRC_COLOR: return GL_ONE_MINUS_SRC_COLOR; - case SRC_ALPHA: return GL_SRC_ALPHA; - case ONE_MINUS_SRC_ALPHA: return GL_ONE_MINUS_SRC_ALPHA; - case DST_COLOR: return GL_DST_COLOR; - case ONE_MINUS_DST_COLOR: return GL_ONE_MINUS_DST_COLOR; - case DST_ALPHA: return GL_DST_ALPHA; - case ONE_MINUS_DST_ALPHA: return GL_ONE_MINUS_DST_ALPHA; - case CONSTANT_COLOR: return GL_CONSTANT_COLOR; - case ONE_MINUS_CONSTANT_COLOR: return GL_ONE_MINUS_CONSTANT_COLOR; - case CONSTANT_ALPHA: return GL_CONSTANT_ALPHA; - case ONE_MINUS_CONSTANT_ALPHA: return GL_ONE_MINUS_CONSTANT_ALPHA; - default: throw invalid_argument("get_gl_blend_factor"); - } -} - void operator>>(const LexicalConverter &conv, BlendEquation &eq) { const string &str = conv.get();