-#include <msp/gl/extensions/ext_blend_minmax.h>
-#include <msp/gl/extensions/ext_blend_subtract.h>
#include <msp/strings/format.h>
#include <msp/strings/utils.h>
#include "blend.h"
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)
{ }
}
-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();