X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Fblend.cpp;h=99ffcd075c933a4441a8535dfed14b735a09acb4;hp=8ceb23829a76894e978dfad03a1531c3421c215e;hb=38712d8ecc57d043a2419ffbaeeb57f7a6586f14;hpb=bae374a3cda6a1b59f36016624ef518bf2676355 diff --git a/source/core/blend.cpp b/source/core/blend.cpp index 8ceb2382..99ffcd07 100644 --- a/source/core/blend.cpp +++ b/source/core/blend.cpp @@ -1,5 +1,3 @@ -#include -#include #include #include #include "blend.h" @@ -9,31 +7,17 @@ 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) { } @@ -64,41 +48,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();