mirror of
https://github.com/borgesdan/xn65
synced 2024-12-29 21:54:47 +01:00
Adiciona PlatformImplementation em SamplerState
This commit is contained in:
parent
1ba86817ec
commit
1955962ae8
@ -54,6 +54,11 @@ namespace xna {
|
|||||||
UINT vSyncValue = 1;
|
UINT vSyncValue = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct SamplerStateImplementation {
|
||||||
|
comptr<ID3D11SamplerState> SamplerState;
|
||||||
|
D3D11_SAMPLER_DESC Description;
|
||||||
|
};
|
||||||
|
|
||||||
struct SpriteBatchImplementation {
|
struct SpriteBatchImplementation {
|
||||||
std::shared_ptr<DirectX::SpriteBatch> SpriteBatch;
|
std::shared_ptr<DirectX::SpriteBatch> SpriteBatch;
|
||||||
comptr<ID3D11InputLayout> InputLayout;
|
comptr<ID3D11InputLayout> InputLayout;
|
||||||
@ -62,7 +67,7 @@ namespace xna {
|
|||||||
|
|
||||||
struct SpriteFontImplementation {
|
struct SpriteFontImplementation {
|
||||||
std::unique_ptr<DirectX::SpriteFont> SpriteFont;
|
std::unique_ptr<DirectX::SpriteFont> SpriteFont;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GamePad::PlatformImplementation {
|
struct GamePad::PlatformImplementation {
|
||||||
uptr<DirectX::GamePad> _dxGamePad = unew<DirectX::GamePad>();
|
uptr<DirectX::GamePad> _dxGamePad = unew<DirectX::GamePad>();
|
||||||
@ -107,12 +112,7 @@ namespace xna {
|
|||||||
struct RasterizerState::PlatformImplementation {
|
struct RasterizerState::PlatformImplementation {
|
||||||
comptr<ID3D11RasterizerState> dxRasterizerState = nullptr;
|
comptr<ID3D11RasterizerState> dxRasterizerState = nullptr;
|
||||||
D3D11_RASTERIZER_DESC dxDescription{};
|
D3D11_RASTERIZER_DESC dxDescription{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SamplerState::PlatformImplementation {
|
|
||||||
comptr<ID3D11SamplerState> _samplerState = nullptr;
|
|
||||||
D3D11_SAMPLER_DESC _description{};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SwapChain::PlatformImplementation {
|
struct SwapChain::PlatformImplementation {
|
||||||
comptr<IDXGISwapChain1> dxSwapChain{ nullptr };
|
comptr<IDXGISwapChain1> dxSwapChain{ nullptr };
|
||||||
|
@ -142,28 +142,7 @@ namespace xna {
|
|||||||
FlipHorizontally = 1,
|
FlipHorizontally = 1,
|
||||||
FlipVertically = 2,
|
FlipVertically = 2,
|
||||||
Both = FlipHorizontally | FlipVertically
|
Both = FlipHorizontally | FlipVertically
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum class TextureAddressMode {
|
|
||||||
Wrap,
|
|
||||||
Mirror,
|
|
||||||
Clamp,
|
|
||||||
Border,
|
|
||||||
MirrorOnce
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class TextureFilter {
|
|
||||||
Linear,
|
|
||||||
Point,
|
|
||||||
Anisotropic,
|
|
||||||
LinearMipPoint,
|
|
||||||
PointMipLinear,
|
|
||||||
MinLinearMagPointMipLinear,
|
|
||||||
MinLinearMagPointMipPoint,
|
|
||||||
MinPointMagLinearMipLinear,
|
|
||||||
MinPointMagLinearMipPoint,
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr int SURFACE_FORMAT_COUNT = 19;
|
constexpr int SURFACE_FORMAT_COUNT = 19;
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,64 @@
|
|||||||
#ifndef XNA_GRAPHICS_SAMPLERSTATE_HPP
|
#ifndef XNA_GRAPHICS_SAMPLERSTATE_HPP
|
||||||
#define XNA_GRAPHICS_SAMPLERSTATE_HPP
|
#define XNA_GRAPHICS_SAMPLERSTATE_HPP
|
||||||
|
|
||||||
#include "../default.hpp"
|
#include "../platform.hpp"
|
||||||
#include "shared.hpp"
|
|
||||||
#include "gresource.hpp"
|
#include "gresource.hpp"
|
||||||
|
#include "shared.hpp"
|
||||||
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace xna {
|
namespace xna {
|
||||||
|
//Defines modes for addressing texels using texture coordinates that are outside of the typical range of 0.0 to 1.0.
|
||||||
|
enum class TextureAddressMode {
|
||||||
|
//Tile the texture at every integer junction.
|
||||||
|
//For example, for u values between 0 and 3, the texture is repeated three times; no mirroring is performed.
|
||||||
|
Wrap,
|
||||||
|
//Similar to Wrap, except that the texture is flipped at every integer junction.
|
||||||
|
//For u values between 0 and 1, for example, the texture is addressed normally; between 1 and 2, the texture is flipped (mirrored); between 2 and 3, the texture is normal again, and so on.
|
||||||
|
Mirror,
|
||||||
|
//Texture coordinates outside the range [0.0, 1.0] are set to the texture color at 0.0 or 1.0, respectively.
|
||||||
|
Clamp,
|
||||||
|
//Texture coordinates outside the range [0.0, 1.0] are set to the border color specified.
|
||||||
|
Border,
|
||||||
|
//Similar to Mirror and Clamp.
|
||||||
|
//Takes the absolute value of the texture coordinate (thus, mirroring around 0), and then clamps to the maximum value.
|
||||||
|
MirrorOnce
|
||||||
|
};
|
||||||
|
|
||||||
|
//Defines filtering types during texture sampling.
|
||||||
|
enum class TextureFilter {
|
||||||
|
//Use linear filtering.
|
||||||
|
Linear,
|
||||||
|
//Use point filtering.
|
||||||
|
Point,
|
||||||
|
//Use anisotropic filtering.
|
||||||
|
Anisotropic,
|
||||||
|
//Use linear filtering to shrink or expand, and point filtering between mipmap levels (mip).
|
||||||
|
LinearMipPoint,
|
||||||
|
//Use point filtering to shrink (minify) or expand (magnify), and linear filtering between mipmap levels.
|
||||||
|
PointMipLinear,
|
||||||
|
//Use linear filtering to shrink, point filtering to expand, and linear filtering between mipmap levels.
|
||||||
|
MinLinearMagPointMipLinear,
|
||||||
|
//Use linear filtering to shrink, point filtering to expand, and point filtering between mipmap levels.
|
||||||
|
MinLinearMagPointMipPoint,
|
||||||
|
//Use point filtering to shrink, linear filtering to expand, and linear filtering between mipmap levels.
|
||||||
|
MinPointMagLinearMipLinear,
|
||||||
|
//Use point filtering to shrink, linear filtering to expand, and point filtering between mipmap levels.
|
||||||
|
MinPointMagLinearMipPoint,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SamplerStateImplementation;
|
||||||
|
|
||||||
//Contains sampler state, which determines how to sample texture data.
|
//Contains sampler state, which determines how to sample texture data.
|
||||||
class SamplerState : public GraphicsResource {
|
class SamplerState : public GraphicsResource, public PlatformImplementation<SamplerStateImplementation> {
|
||||||
public:
|
public:
|
||||||
SamplerState();
|
SamplerState();
|
||||||
SamplerState(sptr<GraphicsDevice> const& device);
|
SamplerState(std::shared_ptr<GraphicsDevice> const& device);
|
||||||
|
|
||||||
//Gets or sets the maximum anisotropy. The default value is 0.
|
//Gets or sets the maximum anisotropy. The default value is 0.
|
||||||
void MaxAnisotropy(Uint value);
|
void MaxAnisotropy(uint32_t value);
|
||||||
//Gets or sets the maximum anisotropy. The default value is 0.
|
//Gets or sets the maximum anisotropy. The default value is 0.
|
||||||
Uint MaxAnisotropy() const;
|
uint32_t MaxAnisotropy() const;
|
||||||
//Gets or sets the type of filtering during sampling.
|
//Gets or sets the type of filtering during sampling.
|
||||||
void Filter(TextureFilter value);
|
void Filter(TextureFilter value);
|
||||||
//Gets or sets the type of filtering during sampling.
|
//Gets or sets the type of filtering during sampling.
|
||||||
@ -49,30 +92,24 @@ namespace xna {
|
|||||||
float MinMipLevel() const;
|
float MinMipLevel() const;
|
||||||
|
|
||||||
//Contains default state for point filtering and texture coordinate wrapping.
|
//Contains default state for point filtering and texture coordinate wrapping.
|
||||||
static uptr<SamplerState> PoinWrap();
|
static std::unique_ptr<SamplerState> PoinWrap();
|
||||||
//Contains default state for point filtering and texture coordinate clamping.
|
//Contains default state for point filtering and texture coordinate clamping.
|
||||||
static uptr<SamplerState> PointClamp();
|
static std::unique_ptr<SamplerState> PointClamp();
|
||||||
//Contains default state for linear filtering and texture coordinate wrapping.
|
//Contains default state for linear filtering and texture coordinate wrapping.
|
||||||
static uptr<SamplerState> LinearWrap();
|
static std::unique_ptr<SamplerState> LinearWrap();
|
||||||
//Contains default state for linear filtering and texture coordinate clamping.
|
//Contains default state for linear filtering and texture coordinate clamping.
|
||||||
static uptr<SamplerState> LinearClamp();
|
static std::unique_ptr<SamplerState> LinearClamp();
|
||||||
//Contains default state for anisotropic filtering and texture coordinate wrapping.
|
//Contains default state for anisotropic filtering and texture coordinate wrapping.
|
||||||
static uptr<SamplerState> AnisotropicWrap();
|
static std::unique_ptr<SamplerState> AnisotropicWrap();
|
||||||
//Contains default state for anisotropic filtering and texture coordinate clamping.
|
//Contains default state for anisotropic filtering and texture coordinate clamping.
|
||||||
static uptr<SamplerState> AnisotropicClamp();
|
static std::unique_ptr<SamplerState> AnisotropicClamp();
|
||||||
|
|
||||||
ComparisonFunction Comparison() const;
|
ComparisonFunction Comparison() const;
|
||||||
void Comparison(ComparisonFunction value);
|
void Comparison(ComparisonFunction value);
|
||||||
|
|
||||||
bool Initialize();
|
bool Initialize();
|
||||||
bool Apply();
|
bool Apply();
|
||||||
|
};
|
||||||
public:
|
|
||||||
struct PlatformImplementation;
|
|
||||||
uptr<PlatformImplementation> impl = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
using PSamplerState = sptr<SamplerState>;
|
|
||||||
|
|
||||||
//Collection of SamplerState objects.
|
//Collection of SamplerState objects.
|
||||||
class SamplerStateCollection {
|
class SamplerStateCollection {
|
||||||
@ -82,10 +119,10 @@ namespace xna {
|
|||||||
SamplerStateCollection(size_t size)
|
SamplerStateCollection(size_t size)
|
||||||
: samplers(size){}
|
: samplers(size){}
|
||||||
|
|
||||||
SamplerStateCollection(std::vector<PSamplerState> const& samplers)
|
SamplerStateCollection(std::vector<std::shared_ptr<SamplerState>> const& samplers)
|
||||||
: samplers(samplers) {}
|
: samplers(samplers) {}
|
||||||
|
|
||||||
PSamplerState operator[](size_t index) {
|
std::shared_ptr<SamplerState> operator[](size_t index) {
|
||||||
if (index >= samplers.size())
|
if (index >= samplers.size())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
@ -99,10 +136,8 @@ namespace xna {
|
|||||||
void Apply(GraphicsDevice const& device);
|
void Apply(GraphicsDevice const& device);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::vector<PSamplerState> samplers;
|
std::vector<std::shared_ptr<SamplerState>> samplers;
|
||||||
};
|
};
|
||||||
|
|
||||||
using PSamplerStateCollection = sptr<SamplerStateCollection>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -6,22 +6,22 @@ namespace xna {
|
|||||||
SamplerState::SamplerState() : SamplerState(nullptr){}
|
SamplerState::SamplerState() : SamplerState(nullptr){}
|
||||||
|
|
||||||
SamplerState::SamplerState(sptr<GraphicsDevice> const& device) : GraphicsResource(device) {
|
SamplerState::SamplerState(sptr<GraphicsDevice> const& device) : GraphicsResource(device) {
|
||||||
impl = unew<PlatformImplementation>();
|
Implementation = unew<SamplerStateImplementation>();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SamplerState::Initialize()
|
bool SamplerState::Initialize()
|
||||||
{
|
{
|
||||||
if (!impl || !BaseGraphicsDevice || !BaseGraphicsDevice->Implementation->Device) {
|
if (!Implementation || !BaseGraphicsDevice || !BaseGraphicsDevice->Implementation->Device) {
|
||||||
Exception::Throw(Exception::UNABLE_TO_INITIALIZE);
|
Exception::Throw(Exception::UNABLE_TO_INITIALIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (impl->_samplerState) {
|
if (Implementation->SamplerState) {
|
||||||
impl->_samplerState = nullptr;
|
Implementation->SamplerState = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto hr = BaseGraphicsDevice->Implementation->Device->CreateSamplerState(
|
const auto hr = BaseGraphicsDevice->Implementation->Device->CreateSamplerState(
|
||||||
&impl->_description,
|
&Implementation->Description,
|
||||||
impl->_samplerState.GetAddressOf());
|
Implementation->SamplerState.GetAddressOf());
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
Exception::Throw(Exception::FAILED_TO_CREATE);
|
Exception::Throw(Exception::FAILED_TO_CREATE);
|
||||||
@ -32,15 +32,15 @@ namespace xna {
|
|||||||
|
|
||||||
bool SamplerState::Apply()
|
bool SamplerState::Apply()
|
||||||
{
|
{
|
||||||
if (!impl || !BaseGraphicsDevice || !BaseGraphicsDevice->Implementation->Context) {
|
if (!Implementation || !BaseGraphicsDevice || !BaseGraphicsDevice->Implementation->Context) {
|
||||||
Exception::Throw(Exception::INVALID_OPERATION);
|
Exception::Throw(Exception::INVALID_OPERATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!impl->_samplerState) {
|
if (!Implementation->SamplerState) {
|
||||||
Exception::Throw(Exception::INVALID_OPERATION);
|
Exception::Throw(Exception::INVALID_OPERATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseGraphicsDevice->Implementation->Context->PSSetSamplers(0, 1, impl->_samplerState.GetAddressOf());
|
BaseGraphicsDevice->Implementation->Context->PSSetSamplers(0, 1, Implementation->SamplerState.GetAddressOf());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -58,10 +58,10 @@ namespace xna {
|
|||||||
for (size_t i = 0; i < samplers.size(); ++i) {
|
for (size_t i = 0; i < samplers.size(); ++i) {
|
||||||
const auto& current = samplers[0];
|
const auto& current = samplers[0];
|
||||||
|
|
||||||
if (!current || !current->impl || !current->impl->_samplerState)
|
if (!current || !current->Implementation || !current->Implementation->SamplerState)
|
||||||
Exception::Throw(Exception::INVALID_OPERATION);
|
Exception::Throw(Exception::INVALID_OPERATION);
|
||||||
|
|
||||||
states[i] = current->impl->_samplerState.Get();
|
states[i] = current->Implementation->SamplerState.Get();
|
||||||
states[i]->AddRef();
|
states[i]->AddRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,55 +78,55 @@ namespace xna {
|
|||||||
|
|
||||||
uptr<SamplerState> SamplerState::PoinWrap() {
|
uptr<SamplerState> SamplerState::PoinWrap() {
|
||||||
auto state = unew<SamplerState>();
|
auto state = unew<SamplerState>();
|
||||||
state->impl->_description.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
|
state->Implementation->Description.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
|
||||||
state->impl->_description.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
|
state->Implementation->Description.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||||
state->impl->_description.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
|
state->Implementation->Description.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||||
state->impl->_description.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
|
state->Implementation->Description.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
uptr<SamplerState> SamplerState::PointClamp() {
|
uptr<SamplerState> SamplerState::PointClamp() {
|
||||||
auto state = unew<SamplerState>();
|
auto state = unew<SamplerState>();
|
||||||
state->impl->_description.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
|
state->Implementation->Description.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
|
||||||
state->impl->_description.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
|
state->Implementation->Description.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||||
state->impl->_description.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
|
state->Implementation->Description.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||||
state->impl->_description.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
|
state->Implementation->Description.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
uptr<SamplerState> SamplerState::LinearWrap() {
|
uptr<SamplerState> SamplerState::LinearWrap() {
|
||||||
auto state = unew<SamplerState>();
|
auto state = unew<SamplerState>();
|
||||||
state->impl->_description.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
state->Implementation->Description.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
||||||
state->impl->_description.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
|
state->Implementation->Description.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||||
state->impl->_description.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
|
state->Implementation->Description.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||||
state->impl->_description.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
|
state->Implementation->Description.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
uptr<SamplerState> SamplerState::LinearClamp() {
|
uptr<SamplerState> SamplerState::LinearClamp() {
|
||||||
auto state = unew<SamplerState>();
|
auto state = unew<SamplerState>();
|
||||||
state->impl->_description.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
state->Implementation->Description.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
||||||
state->impl->_description.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
|
state->Implementation->Description.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||||
state->impl->_description.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
|
state->Implementation->Description.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||||
state->impl->_description.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
|
state->Implementation->Description.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
uptr<SamplerState> SamplerState::AnisotropicWrap() {
|
uptr<SamplerState> SamplerState::AnisotropicWrap() {
|
||||||
auto state = unew<SamplerState>();
|
auto state = unew<SamplerState>();
|
||||||
state->impl->_description.Filter = D3D11_FILTER_ANISOTROPIC;
|
state->Implementation->Description.Filter = D3D11_FILTER_ANISOTROPIC;
|
||||||
state->impl->_description.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
|
state->Implementation->Description.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||||
state->impl->_description.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
|
state->Implementation->Description.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||||
state->impl->_description.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
|
state->Implementation->Description.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
uptr<SamplerState> SamplerState::AnisotropicClamp() {
|
uptr<SamplerState> SamplerState::AnisotropicClamp() {
|
||||||
auto state = unew<SamplerState>();
|
auto state = unew<SamplerState>();
|
||||||
state->impl->_description.Filter = D3D11_FILTER_ANISOTROPIC;
|
state->Implementation->Description.Filter = D3D11_FILTER_ANISOTROPIC;
|
||||||
state->impl->_description.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
|
state->Implementation->Description.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||||
state->impl->_description.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
|
state->Implementation->Description.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||||
state->impl->_description.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
|
state->Implementation->Description.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,31 +134,31 @@ namespace xna {
|
|||||||
switch (value)
|
switch (value)
|
||||||
{
|
{
|
||||||
case xna::TextureFilter::Linear:
|
case xna::TextureFilter::Linear:
|
||||||
impl->_description.Filter = D3D11_FILTER::D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
Implementation->Description.Filter = D3D11_FILTER::D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
||||||
break;
|
break;
|
||||||
case xna::TextureFilter::Point:
|
case xna::TextureFilter::Point:
|
||||||
impl->_description.Filter = D3D11_FILTER::D3D11_FILTER_MIN_MAG_MIP_POINT;
|
Implementation->Description.Filter = D3D11_FILTER::D3D11_FILTER_MIN_MAG_MIP_POINT;
|
||||||
break;
|
break;
|
||||||
case xna::TextureFilter::Anisotropic:
|
case xna::TextureFilter::Anisotropic:
|
||||||
impl->_description.Filter = D3D11_FILTER::D3D11_FILTER_ANISOTROPIC;
|
Implementation->Description.Filter = D3D11_FILTER::D3D11_FILTER_ANISOTROPIC;
|
||||||
break;
|
break;
|
||||||
case xna::TextureFilter::LinearMipPoint:
|
case xna::TextureFilter::LinearMipPoint:
|
||||||
impl->_description.Filter = D3D11_FILTER::D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT;
|
Implementation->Description.Filter = D3D11_FILTER::D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT;
|
||||||
break;
|
break;
|
||||||
case xna::TextureFilter::PointMipLinear:
|
case xna::TextureFilter::PointMipLinear:
|
||||||
impl->_description.Filter = D3D11_FILTER::D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR;
|
Implementation->Description.Filter = D3D11_FILTER::D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR;
|
||||||
break;
|
break;
|
||||||
case xna::TextureFilter::MinLinearMagPointMipLinear:
|
case xna::TextureFilter::MinLinearMagPointMipLinear:
|
||||||
impl->_description.Filter = D3D11_FILTER::D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR;
|
Implementation->Description.Filter = D3D11_FILTER::D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR;
|
||||||
break;
|
break;
|
||||||
case xna::TextureFilter::MinLinearMagPointMipPoint:
|
case xna::TextureFilter::MinLinearMagPointMipPoint:
|
||||||
impl->_description.Filter = D3D11_FILTER::D3D11_FILTER_MIN_LINEAR_MAG_MIP_POINT;
|
Implementation->Description.Filter = D3D11_FILTER::D3D11_FILTER_MIN_LINEAR_MAG_MIP_POINT;
|
||||||
break;
|
break;
|
||||||
case xna::TextureFilter::MinPointMagLinearMipLinear:
|
case xna::TextureFilter::MinPointMagLinearMipLinear:
|
||||||
impl->_description.Filter = D3D11_FILTER::D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR;
|
Implementation->Description.Filter = D3D11_FILTER::D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR;
|
||||||
break;
|
break;
|
||||||
case xna::TextureFilter::MinPointMagLinearMipPoint:
|
case xna::TextureFilter::MinPointMagLinearMipPoint:
|
||||||
impl->_description.Filter = D3D11_FILTER::D3D11_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT;
|
Implementation->Description.Filter = D3D11_FILTER::D3D11_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -166,39 +166,39 @@ namespace xna {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SamplerState::AddressU(TextureAddressMode value) {
|
void SamplerState::AddressU(TextureAddressMode value) {
|
||||||
impl->_description.AddressU = DxHelpers::TextureAddresModeToDx(value);
|
Implementation->Description.AddressU = DxHelpers::TextureAddresModeToDx(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SamplerState::AddressV(TextureAddressMode value) {
|
void SamplerState::AddressV(TextureAddressMode value) {
|
||||||
impl->_description.AddressV = DxHelpers::TextureAddresModeToDx(value);
|
Implementation->Description.AddressV = DxHelpers::TextureAddresModeToDx(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SamplerState::AddressW(TextureAddressMode value) {
|
void SamplerState::AddressW(TextureAddressMode value) {
|
||||||
impl->_description.AddressW = DxHelpers::TextureAddresModeToDx(value);
|
Implementation->Description.AddressW = DxHelpers::TextureAddresModeToDx(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SamplerState::Comparison(ComparisonFunction value) {
|
void SamplerState::Comparison(ComparisonFunction value) {
|
||||||
impl->_description.ComparisonFunc = static_cast<D3D11_COMPARISON_FUNC>(static_cast<int>(value) + 1);
|
Implementation->Description.ComparisonFunc = static_cast<D3D11_COMPARISON_FUNC>(static_cast<int>(value) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SamplerState::MipMapLevelOfDetailBias(float value) {
|
void SamplerState::MipMapLevelOfDetailBias(float value) {
|
||||||
impl->_description.MipLODBias = value;
|
Implementation->Description.MipLODBias = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SamplerState::MinMipLevel(float value) {
|
void SamplerState::MinMipLevel(float value) {
|
||||||
impl->_description.MinLOD = value;
|
Implementation->Description.MinLOD = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SamplerState::MaxMipLevel (float value) {
|
void SamplerState::MaxMipLevel (float value) {
|
||||||
impl->_description.MaxLOD = value;
|
Implementation->Description.MaxLOD = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SamplerState::MaxAnisotropy(Uint value) {
|
void SamplerState::MaxAnisotropy(Uint value) {
|
||||||
impl->_description.MaxAnisotropy = static_cast<UINT>(value);
|
Implementation->Description.MaxAnisotropy = static_cast<UINT>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureFilter SamplerState::Filter() const {
|
TextureFilter SamplerState::Filter() const {
|
||||||
switch (impl->_description.Filter)
|
switch (Implementation->Description.Filter)
|
||||||
{
|
{
|
||||||
case D3D11_FILTER::D3D11_FILTER_MIN_MAG_MIP_LINEAR:
|
case D3D11_FILTER::D3D11_FILTER_MIN_MAG_MIP_LINEAR:
|
||||||
return xna::TextureFilter::Linear;
|
return xna::TextureFilter::Linear;
|
||||||
@ -224,34 +224,34 @@ namespace xna {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TextureAddressMode SamplerState::AddressU() const {
|
TextureAddressMode SamplerState::AddressU() const {
|
||||||
return DxHelpers::TextureAddresModeToXna(impl->_description.AddressU);
|
return DxHelpers::TextureAddresModeToXna(Implementation->Description.AddressU);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureAddressMode SamplerState::AddressV() const {
|
TextureAddressMode SamplerState::AddressV() const {
|
||||||
return DxHelpers::TextureAddresModeToXna(impl->_description.AddressV);
|
return DxHelpers::TextureAddresModeToXna(Implementation->Description.AddressV);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextureAddressMode SamplerState::AddressW() const {
|
TextureAddressMode SamplerState::AddressW() const {
|
||||||
return DxHelpers::TextureAddresModeToXna(impl->_description.AddressW);
|
return DxHelpers::TextureAddresModeToXna(Implementation->Description.AddressW);
|
||||||
}
|
}
|
||||||
|
|
||||||
ComparisonFunction SamplerState::Comparison() const {
|
ComparisonFunction SamplerState::Comparison() const {
|
||||||
return static_cast<ComparisonFunction>(impl->_description.ComparisonFunc - 1);
|
return static_cast<ComparisonFunction>(Implementation->Description.ComparisonFunc - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
float SamplerState::MipMapLevelOfDetailBias() const {
|
float SamplerState::MipMapLevelOfDetailBias() const {
|
||||||
return impl->_description.MipLODBias;
|
return Implementation->Description.MipLODBias;
|
||||||
}
|
}
|
||||||
|
|
||||||
float SamplerState::MinMipLevel() const {
|
float SamplerState::MinMipLevel() const {
|
||||||
return impl->_description.MinLOD;
|
return Implementation->Description.MinLOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
float SamplerState::MaxMipLevel() const {
|
float SamplerState::MaxMipLevel() const {
|
||||||
return impl->_description.MaxLOD;
|
return Implementation->Description.MaxLOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint SamplerState::MaxAnisotropy() const {
|
Uint SamplerState::MaxAnisotropy() const {
|
||||||
return impl->_description.MaxAnisotropy;
|
return Implementation->Description.MaxAnisotropy;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -159,7 +159,7 @@ namespace xna {
|
|||||||
Implementation->SpriteBatch->Begin(
|
Implementation->SpriteBatch->Begin(
|
||||||
_sortMode,
|
_sortMode,
|
||||||
blendState ? blendState->Implementation->BlendState.Get() : nullptr,
|
blendState ? blendState->Implementation->BlendState.Get() : nullptr,
|
||||||
samplerState ? samplerState->impl->_samplerState.Get() : nullptr,
|
samplerState ? samplerState->Implementation->SamplerState.Get() : nullptr,
|
||||||
depthStencil ? depthStencil->Implementation->DepthStencil.Get() : nullptr,
|
depthStencil ? depthStencil->Implementation->DepthStencil.Get() : nullptr,
|
||||||
rasterizerState ? rasterizerState->impl->dxRasterizerState.Get() : nullptr,
|
rasterizerState ? rasterizerState->impl->dxRasterizerState.Get() : nullptr,
|
||||||
effectFunc,
|
effectFunc,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user