20 #ifndef ANTKEEPER_GL_SAMPLER_HPP
21 #define ANTKEEPER_GL_SAMPLER_HPP
62 float mip_lod_bias = 0.0f,
63 float max_anisotropy = 0.0f,
64 bool compare_enabled =
false,
66 float min_lod = -1000.0f,
67 float max_lod = 1000.0f,
68 const std::array<float, 4>& border_color = {0.0f, 0.0f, 0.0f, 0.0f}
185 return m_mipmap_mode;
191 return m_address_mode_u;
197 return m_address_mode_v;
203 return m_address_mode_w;
209 return m_mip_lod_bias;
215 return m_max_anisotropy;
221 return m_compare_enabled;
243 [[nodiscard]]
inline constexpr
const std::array<float, 4>&
get_border_color() const noexcept
245 return m_border_color;
255 unsigned int m_gl_named_sampler{0};
263 float m_mip_lod_bias{0.0f};
264 float m_max_anisotropy{0.0f};
265 bool m_compare_enabled{
false};
267 float m_min_lod{-1000.0f};
268 float m_max_lod{1000.0f};
269 std::array<float, 4> m_border_color{0.0f, 0.0f, 0.0f, 0.0f};
1-dimensional texture shader variable implementation using OpenGL.
2-dimensional texture shader variable implementation using OpenGL.
3-dimensional texture shader variable implementation using OpenGL.
Cube texture shader variable implementation using OpenGL.
Graphics pipeline interface.
constexpr float get_min_lod() const noexcept
Returns the minimum clamp value of the computed LOD.
constexpr const std::array< float, 4 > & get_border_color() const noexcept
Returns the border color used for texture lookups.
void set_min_lod(float lod)
Sets the minimum clamp value of the computed LOD.
void set_max_anisotropy(float anisotropy)
Sets the anisotropy clamp value.
void set_address_mode_w(sampler_address_mode mode)
Sets the addressing mode for W-coordinates outside [0, 1).
sampler & operator=(sampler &&)=delete
constexpr float get_max_lod() const noexcept
Returns the maximum clamp value of the computed LOD.
sampler(sampler &&)=delete
void set_mipmap_mode(sampler_mipmap_mode mode)
Sets the mipmap filter to apply to lookups.
constexpr sampler_address_mode get_address_mode_w() const noexcept
Returns the addressing mode for W-coordinates outside [0, 1).
void set_compare_op(gl::compare_op op)
Sets the comparison operator to apply to fetched data, if compare is enabled.
constexpr sampler_address_mode get_address_mode_u() const noexcept
Returns the addressing mode for U-coordinates outside [0, 1).
constexpr float get_max_anisotropy() const noexcept
Returns the anisotropy clamp value.
constexpr sampler_filter get_mag_filter() const noexcept
Returns the magnification filter to apply to lookups.
constexpr sampler_mipmap_mode get_mipmap_mode() const noexcept
Returns the mipmap filter to apply to lookups.
void set_address_mode_v(sampler_address_mode mode)
Sets the addressing mode for V-coordinates outside [0, 1).
void set_min_filter(sampler_filter filter)
Sets the minification filter to apply to lookups.
constexpr compare_op get_compare_op() const noexcept
Returns the comparison operator to apply to fetched data, if compare is enabled.
constexpr sampler_filter get_min_filter() const noexcept
Returns the minification filter to apply to lookups.
void set_mip_lod_bias(float bias)
Sets the bias to be added to mipmap LOD calculation.
constexpr sampler_address_mode get_address_mode_v() const noexcept
Returns the addressing mode for V-coordinates outside [0, 1).
void set_compare_enabled(bool enabled)
Enables or disables a comparison against a reference value during lookups.
sampler(sampler_filter mag_filter=sampler_filter::linear, sampler_filter min_filter=sampler_filter::nearest, sampler_mipmap_mode mipmap_mode=sampler_mipmap_mode::linear, sampler_address_mode address_mode_u=sampler_address_mode::repeat, sampler_address_mode address_mode_v=sampler_address_mode::repeat, sampler_address_mode address_mode_w=sampler_address_mode::repeat, float mip_lod_bias=0.0f, float max_anisotropy=0.0f, bool compare_enabled=false, gl::compare_op compare_op=gl::compare_op::less, float min_lod=-1000.0f, float max_lod=1000.0f, const std::array< float, 4 > &border_color={0.0f, 0.0f, 0.0f, 0.0f})
Constructs a sampler object.
void set_max_lod(float lod)
Sets the maximum clamp value of the computed LOD.
void set_border_color(const std::array< float, 4 > &color)
Sets the border color used for texture lookups.
void set_mag_filter(sampler_filter filter)
Sets the magnification filter to apply to lookups.
constexpr float get_mip_lod_bias() const noexcept
Returns the bias to be added to mipmap LOD calculation.
sampler & operator=(const sampler &)=delete
sampler(const sampler &)=delete
~sampler()
Destroys a sampler object.
constexpr float get_compare_enabled() const noexcept
Returns true if comparison against a reference value during lookups is enabled, false otherwise.
void set_address_mode_u(sampler_address_mode mode)
Sets the addressing mode for U-coordinates outside [0, 1).
Graphics library interface.
sampler_address_mode
Behaviors of sampling with texture coordinates outside an image.
@ repeat
Repeat wrap mode.
sampler_mipmap_mode
Mipmap modes used for texture lookups.
@ linear
Linear filtering.
sampler_filter
Filters used for texture lookups.
@ linear
Linear filtering.
@ nearest
Nearest filtering.
compare_op
Comparison operators.
@ less
Comparison evaluates reference < test.