Struct nannou::wgpu::SamplerBuilder
source · pub struct SamplerBuilder {
pub descriptor: SamplerDescriptor<'static>,
}
Expand description
Simplifies the construction of a Sampler
with a set of reasonable defaults.
Fields§
§descriptor: SamplerDescriptor<'static>
Implementations§
source§impl<'b> SamplerBuilder
impl<'b> SamplerBuilder
pub const DEFAULT_ADDRESS_MODE_U: AddressMode = wgpu::AddressMode::ClampToEdge
pub const DEFAULT_ADDRESS_MODE_V: AddressMode = wgpu::AddressMode::ClampToEdge
pub const DEFAULT_ADDRESS_MODE_W: AddressMode = wgpu::AddressMode::ClampToEdge
pub const DEFAULT_MAG_FILTER: FilterMode = wgpu::FilterMode::Linear
pub const DEFAULT_MIN_FILTER: FilterMode = wgpu::FilterMode::Linear
pub const DEFAULT_MIPMAP_FILTER: FilterMode = wgpu::FilterMode::Nearest
pub const DEFAULT_LOD_MIN_CLAMP: f32 = 0f32
pub const DEFAULT_LOD_MAX_CLAMP: f32 = 100f32
pub const DEFAULT_COMPARE: Option<CompareFunction> = None
pub const DEFAULT_ANISOTROPY_CLAMP: u16 = 1u16
pub const DEFAULT_LABEL: &'static str = "nannou-sampler"
pub const DEFAULT_BORDER_COLOR: Option<SamplerBorderColor> = None
pub const DEFAULT_DESCRIPTOR: SamplerDescriptor<'static> = _
sourcepub fn new() -> SamplerBuilder
pub fn new() -> SamplerBuilder
Begin building a Sampler
, starting with the Default
parameters.
sourcepub fn address_mode_u(self, mode: AddressMode) -> SamplerBuilder
pub fn address_mode_u(self, mode: AddressMode) -> SamplerBuilder
How the implementation should behave when sampling outside of the texture coordinates range [0.0, 1.0].
sourcepub fn address_mode_v(self, mode: AddressMode) -> SamplerBuilder
pub fn address_mode_v(self, mode: AddressMode) -> SamplerBuilder
How the implementation should behave when sampling outside of the texture coordinates range [0.0, 1.0].
sourcepub fn address_mode_w(self, mode: AddressMode) -> SamplerBuilder
pub fn address_mode_w(self, mode: AddressMode) -> SamplerBuilder
How the implementation should behave when sampling outside of the texture coordinates range [0.0, 1.0].
sourcepub fn address_mode(self, mode: AddressMode) -> SamplerBuilder
pub fn address_mode(self, mode: AddressMode) -> SamplerBuilder
How the implementation should behave when sampling outside of the texture coordinates range [0.0, 1.0].
Applies the same address mode to all axes.
sourcepub fn mag_filter(self, filter: FilterMode) -> SamplerBuilder
pub fn mag_filter(self, filter: FilterMode) -> SamplerBuilder
How the implementation should sample from the image when it is respectively larger than the original.
sourcepub fn min_filter(self, filter: FilterMode) -> SamplerBuilder
pub fn min_filter(self, filter: FilterMode) -> SamplerBuilder
How the implementation should sample from the image when it is respectively smaller than the original.
sourcepub fn mipmap_filter(self, filter: FilterMode) -> SamplerBuilder
pub fn mipmap_filter(self, filter: FilterMode) -> SamplerBuilder
How the implementation should choose which mipmap to use.
sourcepub fn lod_min_clamp(self, min: f32) -> SamplerBuilder
pub fn lod_min_clamp(self, min: f32) -> SamplerBuilder
The minimum mipmap level to use.
sourcepub fn lod_max_clamp(self, max: f32) -> SamplerBuilder
pub fn lod_max_clamp(self, max: f32) -> SamplerBuilder
The maximum mipmap level to use.
sourcepub fn compare(self, f: Option<CompareFunction>) -> SamplerBuilder
pub fn compare(self, f: Option<CompareFunction>) -> SamplerBuilder
The comparison function to use, if any.
sourcepub fn anisotropy_clamp(self, clamp: u16) -> SamplerBuilder
pub fn anisotropy_clamp(self, clamp: u16) -> SamplerBuilder
The anisotropy level to clamp to, if any.
sourcepub fn label(self, label: Option<&'static str>) -> SamplerBuilder
pub fn label(self, label: Option<&'static str>) -> SamplerBuilder
The label to use, if any.
sourcepub fn build(&self, device: &Device) -> Sampler
pub fn build(&self, device: &Device) -> Sampler
Calls device.create_sampler(&self.descriptor)
internally.
sourcepub fn into_descriptor(self) -> SamplerDescriptor<'static>
pub fn into_descriptor(self) -> SamplerDescriptor<'static>
Consume the builder and produce the inner SamplerDescriptor
.
Trait Implementations§
source§impl Debug for SamplerBuilder
impl Debug for SamplerBuilder
source§impl Default for SamplerBuilder
impl Default for SamplerBuilder
source§fn default() -> SamplerBuilder
fn default() -> SamplerBuilder
source§impl From<SamplerDescriptor<'static>> for SamplerBuilder
impl From<SamplerDescriptor<'static>> for SamplerBuilder
source§fn from(descriptor: SamplerDescriptor<'static>) -> SamplerBuilder
fn from(descriptor: SamplerDescriptor<'static>) -> SamplerBuilder
source§impl Into<SamplerDescriptor<'static>> for SamplerBuilder
impl Into<SamplerDescriptor<'static>> for SamplerBuilder
source§fn into(self) -> SamplerDescriptor<'static>
fn into(self) -> SamplerDescriptor<'static>
Auto Trait Implementations§
impl RefUnwindSafe for SamplerBuilder
impl Send for SamplerBuilder
impl Sync for SamplerBuilder
impl Unpin for SamplerBuilder
impl UnwindSafe for SamplerBuilder
Blanket Implementations§
source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
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
source§impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
source§fn convert_into(self) -> U
fn convert_into(self) -> U
source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains the unclamped color. Read more