pub struct SamplerConfig {
pub min_filter: FilterMode,
pub mag_filter: FilterMode,
pub wrap_u: WrapMode,
pub wrap_v: WrapMode,
pub lod_bias: LodBias,
pub max_anisotropy: u8,
}Expand description
Complete configuration for a texture sampler.
Combines filter and wrap modes together with an optional LOD bias and the maximum anisotropy level.
Fields§
§min_filter: FilterModeFiltering applied when the texture is minified.
mag_filter: FilterModeFiltering applied when the texture is magnified.
wrap_u: WrapModeWrapping applied along the U (horizontal) texture axis.
wrap_v: WrapModeWrapping applied along the V (vertical) texture axis.
lod_bias: LodBiasLevel-of-detail bias (applied after automatic mip selection).
max_anisotropy: u8Maximum anisotropy level (1 = isotropic, 16 = maximum).
Implementations§
Source§impl SamplerConfig
impl SamplerConfig
Sourcepub fn linear_clamp() -> Self
pub fn linear_clamp() -> Self
A minimal default: linear filter, clamp-to-edge, no anisotropy.
Sourcepub fn nearest_repeat() -> Self
pub fn nearest_repeat() -> Self
Nearest-neighbour filter, repeat wrapping — good for tiling textures.
Sourcepub fn trilinear_anisotropic() -> Self
pub fn trilinear_anisotropic() -> Self
Trilinear mipmap filtering with 16× anisotropy — high quality.
Sourcepub fn needs_mipmaps(&self) -> bool
pub fn needs_mipmaps(&self) -> bool
Return true if this config requires mipmap generation.
Sourcepub fn clamp_anisotropy(&mut self, hardware_max: u8)
pub fn clamp_anisotropy(&mut self, hardware_max: u8)
Clamp max_anisotropy to the hardware-reported limit.
Trait Implementations§
Source§impl Clone for SamplerConfig
impl Clone for SamplerConfig
Source§fn clone(&self) -> SamplerConfig
fn clone(&self) -> SamplerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SamplerConfig
impl Debug for SamplerConfig
Source§impl Default for SamplerConfig
impl Default for SamplerConfig
Source§impl PartialEq for SamplerConfig
impl PartialEq for SamplerConfig
Source§fn eq(&self, other: &SamplerConfig) -> bool
fn eq(&self, other: &SamplerConfig) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for SamplerConfig
Auto Trait Implementations§
impl Freeze for SamplerConfig
impl RefUnwindSafe for SamplerConfig
impl Send for SamplerConfig
impl Sync for SamplerConfig
impl Unpin for SamplerConfig
impl UnsafeUnpin for SamplerConfig
impl UnwindSafe for SamplerConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more