mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +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:
@@ -69,12 +69,12 @@
|
|||||||
<string>public.app-category.games</string>
|
<string>public.app-category.games</string>
|
||||||
<key>NSHighResolutionCapable</key>
|
<key>NSHighResolutionCapable</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
|
||||||
<false/>
|
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string>© 2006-2016 LÖVE Development Team</string>
|
<string>© 2006-2016 LÖVE Development Team</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
<string>NSApplication</string>
|
<string>NSApplication</string>
|
||||||
|
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||||
|
<false/>
|
||||||
<key>UTExportedTypeDeclarations</key>
|
<key>UTExportedTypeDeclarations</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
|
|||||||
@@ -610,6 +610,7 @@ StringMap<Graphics::BlendMode, Graphics::BLEND_MAX_ENUM>::Entry Graphics::blendM
|
|||||||
{ "darken", BLEND_DARKEN },
|
{ "darken", BLEND_DARKEN },
|
||||||
{ "screen", BLEND_SCREEN },
|
{ "screen", BLEND_SCREEN },
|
||||||
{ "replace", BLEND_REPLACE },
|
{ "replace", BLEND_REPLACE },
|
||||||
|
{ "none", BLEND_NONE },
|
||||||
};
|
};
|
||||||
|
|
||||||
StringMap<Graphics::BlendMode, Graphics::BLEND_MAX_ENUM> Graphics::blendModes(Graphics::blendModeEntries, sizeof(Graphics::blendModeEntries));
|
StringMap<Graphics::BlendMode, Graphics::BLEND_MAX_ENUM> Graphics::blendModes(Graphics::blendModeEntries, sizeof(Graphics::blendModeEntries));
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ public:
|
|||||||
BLEND_DARKEN,
|
BLEND_DARKEN,
|
||||||
BLEND_SCREEN,
|
BLEND_SCREEN,
|
||||||
BLEND_REPLACE,
|
BLEND_REPLACE,
|
||||||
|
BLEND_NONE,
|
||||||
BLEND_MAX_ENUM
|
BLEND_MAX_ENUM
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1602,6 +1602,7 @@ void Graphics::setBlendMode(BlendMode mode, BlendAlpha alphamode)
|
|||||||
dstRGB = dstA = GL_ONE_MINUS_SRC_COLOR;
|
dstRGB = dstA = GL_ONE_MINUS_SRC_COLOR;
|
||||||
break;
|
break;
|
||||||
case BLEND_REPLACE:
|
case BLEND_REPLACE:
|
||||||
|
case BLEND_NONE:
|
||||||
default:
|
default:
|
||||||
srcRGB = srcA = GL_ONE;
|
srcRGB = srcA = GL_ONE;
|
||||||
dstRGB = dstA = GL_ZERO;
|
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.
|
// 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;
|
srcRGB = GL_SRC_ALPHA;
|
||||||
|
|
||||||
glBlendEquation(func);
|
glBlendEquation(func);
|
||||||
|
|||||||
Reference in New Issue
Block a user