pub struct SamplerOnce;Expand description
A texture sampler that assumes all texture coordinates are within bounds.
Out-of-bounds coordinates may cause graphical glitches or runtime panics
but not undefined behavior. In particular, if the texture data is a slice
of a larger buffer, SamplerOnce may read out of bounds of the slice but
not of the backing buffer.
Implementations§
Source§impl SamplerOnce
impl SamplerOnce
Sourcepub fn sample<C: Copy>(
&self,
tex: &Texture<impl AsSlice2<C>>,
tc: TexCoord,
) -> C
pub fn sample<C: Copy>( &self, tex: &Texture<impl AsSlice2<C>>, tc: TexCoord, ) -> C
Returns the color in tex at tc such that both coordinates are
assumed to be in the range 0.0..1.0.
Uses nearest neighbor sampling. Passing out-of-range coordinates to this function is sound (not UB) but is not otherwise specified.
§Panics
May panic if tc is not in the valid range.
Sourcepub fn sample_abs<C: Copy>(
&self,
tex: &Texture<impl AsSlice2<C>>,
tc: TexCoord,
) -> C
pub fn sample_abs<C: Copy>( &self, tex: &Texture<impl AsSlice2<C>>, tc: TexCoord, ) -> C
Returns the color in tex at tc such that the coordinates are
assumed to be in the ranges 0.0..tex.width() and 0.0..tex.height()
respectively.
Uses nearest neighbor sampling. Passing out-of-range coordinates to this function is sound (not UB) but is not otherwise specified.
§Panics
May panic if tc is not in the valid range.
Trait Implementations§
Source§impl Clone for SamplerOnce
impl Clone for SamplerOnce
Source§fn clone(&self) -> SamplerOnce
fn clone(&self) -> SamplerOnce
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more