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

107 lines
3.6 KiB
C++
Raw Normal View History

2024-04-13 11:45:45 -03:00
#ifndef XNA_GRAPHICS_SAMPLERSTATE_HPP
#define XNA_GRAPHICS_SAMPLERSTATE_HPP
#include "../default.hpp"
2024-05-22 11:55:13 -03:00
#include "gresource.hpp"
2024-04-13 11:45:45 -03:00
namespace xna {
//Contains sampler state, which determines how to sample texture data.
2024-06-24 15:11:07 -03:00
class SamplerState : public GraphicsResource {
2024-04-13 11:45:45 -03:00
public:
2024-05-22 11:55:13 -03:00
SamplerState();
SamplerState(sptr<GraphicsDevice> const& device);
//Gets or sets the maximum anisotropy. The default value is 0.
2024-05-22 11:55:13 -03:00
void MaxAnisotropy(Uint value);
//Gets or sets the maximum anisotropy. The default value is 0.
Uint MaxAnisotropy() const;
//Gets or sets the type of filtering during sampling.
void Filter(TextureFilter value);
//Gets or sets the type of filtering during sampling.
2024-05-22 11:55:13 -03:00
TextureFilter Filter() const;
////Gets or sets the texture-address mode for the u-coordinate.
void AddressU(TextureAddressMode value);
//Gets or sets the texture-address mode for the u-coordinate.
2024-05-22 11:55:13 -03:00
TextureAddressMode AddressU() const;
//Gets or sets the texture-address mode for the v-coordinate.
2024-05-22 11:55:13 -03:00
TextureAddressMode AddressV() const;
//Gets or sets the texture-address mode for the v-coordinate.
void AddressV(TextureAddressMode value);
//Gets or sets the texture-address mode for the w-coordinate.
2024-05-22 11:55:13 -03:00
TextureAddressMode AddressW() const;
////Gets or sets the texture-address mode for the w-coordinate.
void AddressW(TextureAddressMode value);
//Gets or sets the mipmap LOD bias. The default value is 0.
void MipMapLevelOfDetailBias(float value);
//Gets or sets the mipmap LOD bias. The default value is 0.
float MipMapLevelOfDetailBias() const;
//Gets or sets the level of detail (LOD) index of the largest map to use.
float MaxMipLevel() const;
//Gets or sets the level of detail (LOD) index of the largest map to use.
void MaxMipLevel(float value);
2024-05-22 11:55:13 -03:00
//Gets or sets the level of detail (LOD) index of the smaller map to use.
void MinMipLevel(float value);
//Gets or sets the level of detail (LOD) index of the smaller map to use.
float MinMipLevel() const;
//Contains default state for point filtering and texture coordinate wrapping.
2024-05-22 11:55:13 -03:00
static uptr<SamplerState> PoinWrap();
//Contains default state for point filtering and texture coordinate clamping.
2024-05-22 11:55:13 -03:00
static uptr<SamplerState> PointClamp();
//Contains default state for linear filtering and texture coordinate wrapping.
2024-05-22 11:55:13 -03:00
static uptr<SamplerState> LinearWrap();
//Contains default state for linear filtering and texture coordinate clamping.
2024-05-22 11:55:13 -03:00
static uptr<SamplerState> LinearClamp();
//Contains default state for anisotropic filtering and texture coordinate wrapping.
2024-05-22 11:55:13 -03:00
static uptr<SamplerState> AnisotropicWrap();
//Contains default state for anisotropic filtering and texture coordinate clamping.
2024-05-22 11:55:13 -03:00
static uptr<SamplerState> AnisotropicClamp();
ComparisonFunction Comparison() const;
void Comparison(ComparisonFunction value);
bool Initialize();
bool Apply();
2024-05-22 11:55:13 -03:00
public:
struct PlatformImplementation;
uptr<PlatformImplementation> impl = nullptr;
2024-04-13 11:45:45 -03:00
};
2024-06-24 15:11:07 -03:00
using PSamplerState = sptr<SamplerState>;
//Collection of SamplerState objects.
class SamplerStateCollection {
public:
SamplerStateCollection(){}
SamplerStateCollection(size_t size)
: samplers(size){}
SamplerStateCollection(std::vector<PSamplerState> const& samplers)
: samplers(samplers) {}
PSamplerState operator[](size_t index) {
if (index >= samplers.size())
return nullptr;
return samplers[index];
}
2024-06-25 15:41:11 -03:00
constexpr size_t Count() const {
return samplers.size();
}
void Apply(GraphicsDevice const& device);
2024-06-24 15:11:07 -03:00
public:
std::vector<PSamplerState> samplers;
};
using PSamplerStateCollection = sptr<SamplerStateCollection>;
2024-04-13 11:45:45 -03:00
}
#endif