mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Added “none” blend mode. This is equivalent to setBlendMode(“replace”, “premultiplied”) (which also effectively disables blending) but doesn’t require explicitly setting the alpha multiplication mode.
--HG-- branch : minor
This commit is contained in:
@@ -610,6 +610,7 @@ StringMap<Graphics::BlendMode, Graphics::BLEND_MAX_ENUM>::Entry Graphics::blendM
|
||||
{ "darken", BLEND_DARKEN },
|
||||
{ "screen", BLEND_SCREEN },
|
||||
{ "replace", BLEND_REPLACE },
|
||||
{ "none", BLEND_NONE },
|
||||
};
|
||||
|
||||
StringMap<Graphics::BlendMode, Graphics::BLEND_MAX_ENUM> Graphics::blendModes(Graphics::blendModeEntries, sizeof(Graphics::blendModeEntries));
|
||||
|
||||
@@ -97,6 +97,7 @@ public:
|
||||
BLEND_DARKEN,
|
||||
BLEND_SCREEN,
|
||||
BLEND_REPLACE,
|
||||
BLEND_NONE,
|
||||
BLEND_MAX_ENUM
|
||||
};
|
||||
|
||||
|
||||
@@ -1602,6 +1602,7 @@ void Graphics::setBlendMode(BlendMode mode, BlendAlpha alphamode)
|
||||
dstRGB = dstA = GL_ONE_MINUS_SRC_COLOR;
|
||||
break;
|
||||
case BLEND_REPLACE:
|
||||
case BLEND_NONE:
|
||||
default:
|
||||
srcRGB = srcA = GL_ONE;
|
||||
dstRGB = dstA = GL_ZERO;
|
||||
@@ -1609,7 +1610,7 @@ void Graphics::setBlendMode(BlendMode mode, BlendAlpha alphamode)
|
||||
}
|
||||
|
||||
// We can only do alpha-multiplication when srcRGB would have been unmodified.
|
||||
if (srcRGB == GL_ONE && alphamode == BLENDALPHA_MULTIPLY)
|
||||
if (srcRGB == GL_ONE && alphamode == BLENDALPHA_MULTIPLY && mode != BLEND_NONE)
|
||||
srcRGB = GL_SRC_ALPHA;
|
||||
|
||||
glBlendEquation(func);
|
||||
|
||||
Reference in New Issue
Block a user