2024-03-18 15:41:46 -03:00
|
|
|
#ifndef XNA_PLATFORM_TEXTURE_DX_HPP
|
|
|
|
#define XNA_PLATFORM_TEXTURE_DX_HPP
|
|
|
|
|
|
|
|
#include "../graphics/texture.hpp"
|
|
|
|
#include "dxgi.h"
|
|
|
|
#include "d3d11.h"
|
2024-04-07 14:06:12 -03:00
|
|
|
#include "../xnaerror.hpp"
|
2024-03-18 15:41:46 -03:00
|
|
|
|
|
|
|
namespace xna {
|
2024-03-21 16:01:47 -03:00
|
|
|
class Texture2D : public ITexture2D {
|
|
|
|
public:
|
|
|
|
Texture2D();
|
2024-03-18 15:41:46 -03:00
|
|
|
|
2024-03-21 16:01:47 -03:00
|
|
|
virtual ~Texture2D() override {
|
|
|
|
if (_texture2D) {
|
|
|
|
_texture2D->Release();
|
|
|
|
_texture2D = nullptr;
|
|
|
|
}
|
2024-04-14 16:11:15 -03:00
|
|
|
|
|
|
|
if (_textureView) {
|
|
|
|
_textureView->Release();
|
|
|
|
_textureView = nullptr;
|
|
|
|
}
|
2024-03-21 16:01:47 -03:00
|
|
|
}
|
|
|
|
|
2024-04-07 14:06:12 -03:00
|
|
|
virtual constexpr Int Width() const override {
|
2024-04-14 16:11:15 -03:00
|
|
|
return _description.Width;
|
2024-04-07 14:06:12 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual constexpr Int Height() const override {
|
2024-04-14 16:11:15 -03:00
|
|
|
return _description.Height;
|
2024-04-07 14:06:12 -03:00
|
|
|
}
|
|
|
|
|
2024-04-26 11:35:59 -03:00
|
|
|
static sptr<Texture2D> FromStream(GraphicsDevice& device, String const& fileName, xna_error_nullarg);
|
2024-04-07 14:06:12 -03:00
|
|
|
|
2024-03-21 16:01:47 -03:00
|
|
|
public:
|
2024-03-18 15:41:46 -03:00
|
|
|
ID3D11Texture2D* _texture2D{nullptr};
|
2024-04-14 16:11:15 -03:00
|
|
|
ID3D11ShaderResourceView* _textureView{ nullptr };
|
|
|
|
D3D11_TEXTURE2D_DESC _description{};
|
|
|
|
|
2024-03-18 15:41:46 -03:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|