1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00

Corrige IBlendState e IGraphicsDevice

This commit is contained in:
Danilo 2024-04-02 09:27:43 -03:00
parent 1e96338617
commit 092a15ee2f
4 changed files with 34 additions and 37 deletions

View File

@ -31,11 +31,6 @@ namespace xna {
static PBlendState NonPremultiplied();
virtual bool Apply(GraphicsDevice* device) = 0;
public:
bool AlphaToCoverage{ false };
bool IndependentBlendEnable{ false };
PBlendRenderTarget RenderTargets[8];
};
}

View File

@ -18,38 +18,11 @@ namespace xna {
virtual void Clear() = 0;
virtual bool Initialize(GameWindow& gameWindow) = 0;
virtual bool Present() = 0;
PGraphicsAdapter Adapter() const {
return _adapter;
}
void Adapter(PGraphicsAdapter const& adapter) {
_adapter = adapter;
}
constexpr xna::Viewport Viewport() const {
return _viewport;
}
constexpr void Viewport(xna::Viewport const& viewport) {
_viewport = viewport;
}
PSwapChain GetSwapChain() const {
return _swapChain;
}
constexpr void UseVSync(bool use) {
_usevsync = use;
}
protected:
PGraphicsAdapter _adapter{ nullptr };
PSwapChain _swapChain{ nullptr };
PRenderTarget2D _renderTarget2D{ nullptr };
xna::Viewport _viewport{};
PBlendState _blendState{ nullptr };
bool _usevsync{ false };
virtual PGraphicsAdapter Adapter() const = 0;
virtual void Adapter(PGraphicsAdapter const& adapter) = 0;
virtual xna::Viewport Viewport() const = 0;
virtual void Viewport(xna::Viewport const& viewport) = 0;
virtual void UseVSync(bool use) = 0;
};
}

View File

@ -22,6 +22,9 @@ namespace xna {
public:
ID3D11BlendState* _blendState{ nullptr };
GraphicsDevice* _device{ nullptr };
bool AlphaToCoverage{ false };
bool IndependentBlendEnable{ false };
PBlendRenderTarget RenderTargets[8];
};
struct BlendMapper {

View File

@ -28,6 +28,26 @@ namespace xna {
virtual bool Initialize(GameWindow& gameWindow) override;
virtual bool Present() override;
virtual PGraphicsAdapter Adapter() const override {
return _adapter;
}
virtual void Adapter(PGraphicsAdapter const& adapter) override {
_adapter = adapter;
}
virtual constexpr xna::Viewport Viewport() const override {
return _viewport;
}
virtual constexpr void Viewport(xna::Viewport const& viewport) override {
_viewport = viewport;
}
virtual void UseVSync(bool use) override {
_usevsync = use;
}
constexpr void SetCreateFlags(D3D11_CREATE_DEVICE_FLAG flags) {
_createDeviceFlags |= flags;
}
@ -47,6 +67,12 @@ namespace xna {
D3D_FEATURE_LEVEL _featureLevel{ D3D_FEATURE_LEVEL::D3D_FEATURE_LEVEL_11_0 };
float _backgroundColor[4] = { 0, 0, 0, 0 };
xna::PresentationParameters _presentParameters;
PGraphicsAdapter _adapter{ nullptr };
PSwapChain _swapChain{ nullptr };
PRenderTarget2D _renderTarget2D{ nullptr };
xna::Viewport _viewport{};
PBlendState _blendState{ nullptr };
bool _usevsync{ false };
bool createDevice();
};