2024-03-18 15:41:46 -03:00
|
|
|
#ifndef XNA_GRAPHICS_BLENDSTATE_HPP
|
|
|
|
#define XNA_GRAPHICS_BLENDSTATE_HPP
|
|
|
|
|
|
|
|
#include "../types.hpp"
|
|
|
|
#include "../forward.hpp"
|
|
|
|
#include "../enums.hpp"
|
|
|
|
|
|
|
|
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-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();
|
|
|
|
|
|
|
|
virtual bool Apply(GraphicsDevice* device) = 0;
|
2024-03-18 15:41:46 -03:00
|
|
|
|
|
|
|
public:
|
2024-03-24 16:12:17 -03:00
|
|
|
bool AlphaToCoverage{ false };
|
|
|
|
bool IndependentBlendEnable{ false };
|
|
|
|
PBlendRenderTarget RenderTargets[8];
|
2024-03-21 16:01:47 -03:00
|
|
|
};
|
2024-03-18 15:41:46 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|