From 7ff9478061e369d31228c2f98f8ec91f02de49d5 Mon Sep 17 00:00:00 2001 From: Krozark Date: Thu, 13 Aug 2015 14:40:20 +0200 Subject: [PATCH] add a new BlendMode::Equation : ReverseSubtract --- include/SFML/Graphics/BlendMode.hpp | 5 +++-- src/SFML/Graphics/GLExtensions.hpp | 2 ++ src/SFML/Graphics/RenderTarget.cpp | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/SFML/Graphics/BlendMode.hpp b/include/SFML/Graphics/BlendMode.hpp index 7f5803be..08f049dd 100644 --- a/include/SFML/Graphics/BlendMode.hpp +++ b/include/SFML/Graphics/BlendMode.hpp @@ -68,8 +68,9 @@ struct SFML_GRAPHICS_API BlendMode //////////////////////////////////////////////////////// enum Equation { - Add, ///< Pixel = Src * SrcFactor + Dst * DstFactor - Subtract ///< Pixel = Src * SrcFactor - Dst * DstFactor + Add, ///< Pixel = Src * SrcFactor + Dst * DstFactor + Subtract, ///< Pixel = Src * SrcFactor - Dst * DstFactor + ReverseSubtract ///< Pixel = Dst * DstFactor - Src * SrcFactor }; //////////////////////////////////////////////////////////// diff --git a/src/SFML/Graphics/GLExtensions.hpp b/src/SFML/Graphics/GLExtensions.hpp index 7f76de9e..bcc5d7e6 100644 --- a/src/SFML/Graphics/GLExtensions.hpp +++ b/src/SFML/Graphics/GLExtensions.hpp @@ -64,6 +64,7 @@ #define GLEXT_glBlendEquation glBlendEquationOES #define GLEXT_GL_FUNC_ADD GL_FUNC_ADD_OES #define GLEXT_GL_FUNC_SUBTRACT GL_FUNC_SUBTRACT_OES + #define GLEXT_GL_FUNC_REVERSE_SUBTRACT GL_FUNC_REVERSE_SUBTRACT_OES // The following extensions are optional. @@ -142,6 +143,7 @@ // Core since 1.2 - EXT_blend_subtract #define GLEXT_blend_subtract sfogl_ext_EXT_blend_subtract #define GLEXT_GL_FUNC_SUBTRACT GL_FUNC_SUBTRACT_EXT + #define GLEXT_GL_FUNC_REVERSE_SUBTRACT GL_FUNC_REVERSE_SUBTRACT_EXT // Core since 1.3 - ARB_multitexture #define GLEXT_multitexture sfogl_ext_ARB_multitexture diff --git a/src/SFML/Graphics/RenderTarget.cpp b/src/SFML/Graphics/RenderTarget.cpp index 28b35e45..ded377c1 100644 --- a/src/SFML/Graphics/RenderTarget.cpp +++ b/src/SFML/Graphics/RenderTarget.cpp @@ -67,6 +67,7 @@ namespace { case sf::BlendMode::Add: return GLEXT_GL_FUNC_ADD; case sf::BlendMode::Subtract: return GLEXT_GL_FUNC_SUBTRACT; + case sf::BlendMode::ReverseSubtract: return GLEXT_GL_FUNC_REVERSE_SUBTRACT; } sf::err() << "Invalid value for sf::BlendMode::Equation! Fallback to sf::BlendMode::Add." << std::endl;