mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 15:51:04 +08:00
Fixed compile error (trailing enum comma) and other minor things
This commit is contained in:
parent
fe7d6f513d
commit
05d196d86d
@ -57,7 +57,7 @@ struct SFML_GRAPHICS_API BlendMode
|
||||
SrcAlpha, ///< (src.a,src.a,src.a,src.a)
|
||||
OneMinusSrcAlpha, ///< (1,1,1,1) - (src.a,src.a,src.a,src.a)
|
||||
DstAlpha, ///< (dst.a,dst.a,dst.a,dst.a)
|
||||
OneMinusDstAlpha, ///< (1,1,1,1) - (dst.a,dst.a,dst.a,dst.a)
|
||||
OneMinusDstAlpha ///< (1,1,1,1) - (dst.a,dst.a,dst.a,dst.a)
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
@ -67,8 +67,8 @@ struct SFML_GRAPHICS_API BlendMode
|
||||
////////////////////////////////////////////////////////
|
||||
enum BlendEquation
|
||||
{
|
||||
Add, ///< Pixel = Source * SourceFactor + Dst * DstFactor
|
||||
Subtract, ///< Pixel = Source * SourceFactor - Dst * DstFactor
|
||||
Add, ///< Pixel = Src * SrcFactor + Dst * DstFactor
|
||||
Subtract ///< Pixel = Src * SrcFactor - Dst * DstFactor
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -83,17 +83,16 @@ struct SFML_GRAPHICS_API BlendMode
|
||||
/// \brief Construct the blend mode given the factors and equation.
|
||||
///
|
||||
/// \param colorSourceFactor Specifies how to compute the source factor for the color channels.
|
||||
/// \param colorDstFactor Specifies how to compute the destination factor for the color channels.
|
||||
/// \param colorDestinationFactor Specifies how to compute the destination factor for the color channels.
|
||||
/// \param colorBlendEquation Specifies how to combine the source and destination colors.
|
||||
/// \param alphaSourceFactor Specifies how to compute the source factor.
|
||||
/// \param alphaDstFactor Specifies how to compute the destination factor.
|
||||
/// \param alphaDestinationFactor Specifies how to compute the destination factor.
|
||||
/// \param alphaBlendEquation Specifies how to combine the source and destination alphas.
|
||||
///
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
BlendMode(BlendFactor colorSourceFactor, BlendFactor colorDstFactor,
|
||||
BlendMode(BlendFactor colorSourceFactor, BlendFactor colorDestinationFactor,
|
||||
BlendEquation colorBlendEquation, BlendFactor alphaSourceFactor,
|
||||
BlendFactor alphaDstFactor, BlendEquation alphaBlendEquation);
|
||||
BlendFactor alphaDestinationFactor, BlendEquation alphaBlendEquation);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member Data
|
||||
@ -110,8 +109,6 @@ struct SFML_GRAPHICS_API BlendMode
|
||||
/// \relates BlendMode
|
||||
/// \brief Overload of the == operator
|
||||
///
|
||||
/// This operator compares two blending modes and checks if they are equal.
|
||||
///
|
||||
/// \param left Left operand
|
||||
/// \param right Right operand
|
||||
///
|
||||
@ -124,8 +121,6 @@ SFML_GRAPHICS_API bool operator ==(const BlendMode& left, const BlendMode& right
|
||||
/// \relates BlendMode
|
||||
/// \brief Overload of the != operator
|
||||
///
|
||||
/// This operator compares two blending modes and checks if they are different.
|
||||
///
|
||||
/// \param left Left operand
|
||||
/// \param right Right operand
|
||||
///
|
||||
@ -162,7 +157,7 @@ SFML_GRAPHICS_API extern const BlendMode BlendNone;
|
||||
/// \li Alpha Destination Factor (alphaDstFactor)
|
||||
/// \li Alpha Blend Equation (alphaEquation)
|
||||
///
|
||||
/// Each component has its own setter function. These make
|
||||
/// Each component has its own public member variable. These make
|
||||
/// modifying a blending mode rather easy:
|
||||
///
|
||||
/// \code
|
||||
@ -171,9 +166,9 @@ SFML_GRAPHICS_API extern const BlendMode BlendNone;
|
||||
/// blendMode.colorEquation = sf::BlendMode::Subtract; // An exotic subtraction blending mode
|
||||
/// \endcode
|
||||
///
|
||||
/// The most common blending modes are defined as const
|
||||
/// variables for convenience and compatibility with older
|
||||
/// code:
|
||||
/// The most common blending modes are defined as constants
|
||||
/// in the sf namespace, for convenience and compatibility with
|
||||
/// older code:
|
||||
///
|
||||
/// \code
|
||||
/// sf::BlendMode alphaBlending = sf::BlendAlpha;
|
||||
|
@ -354,7 +354,7 @@ private:
|
||||
/// \param mode Blending mode to apply
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
void applyBlendMode(BlendMode mode);
|
||||
void applyBlendMode(const BlendMode& mode);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Apply a new transform
|
||||
|
@ -1,7 +1,7 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
||||
// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
@ -26,7 +26,6 @@
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/BlendMode.hpp>
|
||||
#include <SFML/Graphics/GLCheck.hpp>
|
||||
|
||||
|
||||
namespace sf
|
||||
@ -58,14 +57,14 @@ alphaEquation (BlendMode::Add)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
BlendMode::BlendMode(BlendFactor colorSourceFactor, BlendFactor colorDstFactor,
|
||||
BlendMode::BlendMode(BlendFactor colorSourceFactor, BlendFactor colorDestinationFactor,
|
||||
BlendEquation colorBlendEquation, BlendFactor alphaSourceFactor,
|
||||
BlendFactor alphaDstFactor, BlendEquation alphaBlendEquation) :
|
||||
BlendFactor alphaDestinationFactor, BlendEquation alphaBlendEquation) :
|
||||
colorSrcFactor(colorSourceFactor),
|
||||
colorDstFactor(colorDstFactor),
|
||||
colorDstFactor(colorDestinationFactor),
|
||||
colorEquation (colorBlendEquation),
|
||||
alphaSrcFactor(alphaSourceFactor),
|
||||
alphaDstFactor(alphaDstFactor),
|
||||
alphaDstFactor(alphaDestinationFactor),
|
||||
alphaEquation (alphaBlendEquation)
|
||||
{
|
||||
|
||||
|
@ -388,22 +388,32 @@ void RenderTarget::applyCurrentView()
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void RenderTarget::applyBlendMode(BlendMode mode)
|
||||
void RenderTarget::applyBlendMode(const BlendMode& mode)
|
||||
{
|
||||
// Apply the blend mode, falling back to the non-separate versions if necessary
|
||||
if (GLEW_EXT_blend_func_separate)
|
||||
glCheck(glBlendFuncSeparateEXT(factorToGlConstant(mode.colorSrcFactor),
|
||||
factorToGlConstant(mode.colorDstFactor), factorToGlConstant(mode.alphaSrcFactor),
|
||||
factorToGlConstant(mode.alphaDstFactor)));
|
||||
{
|
||||
glCheck(glBlendFuncSeparateEXT(
|
||||
factorToGlConstant(mode.colorSrcFactor), factorToGlConstant(mode.colorDstFactor),
|
||||
factorToGlConstant(mode.alphaSrcFactor), factorToGlConstant(mode.alphaDstFactor)));
|
||||
}
|
||||
else
|
||||
glCheck(glBlendFunc(factorToGlConstant(mode.colorSrcFactor),
|
||||
{
|
||||
glCheck(glBlendFunc(
|
||||
factorToGlConstant(mode.colorSrcFactor),
|
||||
factorToGlConstant(mode.colorDstFactor)));
|
||||
}
|
||||
|
||||
if (GLEW_EXT_blend_equation_separate)
|
||||
glCheck(glBlendEquationSeparateEXT(equationToGlConstant(mode.colorEquation),
|
||||
{
|
||||
glCheck(glBlendEquationSeparateEXT(
|
||||
equationToGlConstant(mode.colorEquation),
|
||||
equationToGlConstant(mode.alphaEquation)));
|
||||
}
|
||||
else
|
||||
{
|
||||
glCheck(glBlendEquation(equationToGlConstant(mode.colorEquation)));
|
||||
}
|
||||
|
||||
m_cache.lastBlendMode = mode;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user