2024-03-18 15:41:46 -03:00
|
|
|
#ifndef XNA_GRAPHICS_BLENDSTATE_HPP
|
|
|
|
#define XNA_GRAPHICS_BLENDSTATE_HPP
|
|
|
|
|
2024-04-13 21:04:12 -03:00
|
|
|
#include "../default.hpp"
|
2024-03-18 15:41:46 -03:00
|
|
|
|
|
|
|
namespace xna {
|
2024-03-24 16:12:17 -03:00
|
|
|
struct BlendRenderTarget {
|
|
|
|
bool Enabled{ true };
|
|
|
|
Blend Source{ Blend::SourceAlpha };
|
|
|
|
Blend Destination{ Blend::InverseSourceAlpha };
|
|
|
|
BlendOperation Operation{ BlendOperation::Add };
|
|
|
|
Blend SourceAlpha{ Blend::One };
|
|
|
|
Blend DestinationAlpha{ Blend::Zero };
|
|
|
|
BlendOperation OperationAlpha{ BlendOperation::Add };
|
|
|
|
ColorWriteChannels WriteMask{ ColorWriteChannels::All };
|
|
|
|
|
|
|
|
constexpr BlendRenderTarget() = default;
|
|
|
|
};
|
|
|
|
|
|
|
|
using PBlendRenderTarget = sptr<BlendRenderTarget>;
|
|
|
|
|
2024-03-21 16:01:47 -03:00
|
|
|
class IBlendState {
|
2024-03-18 15:41:46 -03:00
|
|
|
public:
|
2024-03-24 16:12:17 -03:00
|
|
|
virtual ~IBlendState() {}
|
2024-04-13 21:04:12 -03:00
|
|
|
virtual bool Initialize(GraphicsDevice& device, xna_error_nullarg) = 0;
|
|
|
|
virtual void AlphaToCoverageEnable(bool value) = 0;
|
|
|
|
virtual void IndependentBlendEnable(bool value) = 0;
|
|
|
|
virtual void RenderTargets(std::vector<BlendRenderTarget> const& value) = 0;
|
|
|
|
|
|
|
|
virtual bool Apply(GraphicsDevice& device, xna_error_nullarg) = 0;
|
2024-03-18 15:41:46 -03:00
|
|
|
|
2024-03-21 16:01:47 -03:00
|
|
|
static PBlendState Opaque();
|
|
|
|
static PBlendState AlphaBlend();
|
|
|
|
static PBlendState Additive();
|
|
|
|
static PBlendState NonPremultiplied();
|
|
|
|
};
|
2024-03-18 15:41:46 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|