[−][src]Struct luminance::texture::Texture
Texture.
L
refers to the layering type; D
refers to the dimension; P
is the pixel format for the
texels.
Methods
impl<L, D, P> Texture<L, D, P> where
L: Layerable,
D: Dimensionable,
P: Pixel,
[src]
L: Layerable,
D: Dimensionable,
P: Pixel,
pub fn new<C>(
ctx: &mut C,
size: D::Size,
mipmaps: usize,
sampler: Sampler
) -> Result<Self, TextureError> where
C: GraphicsContext,
[src]
ctx: &mut C,
size: D::Size,
mipmaps: usize,
sampler: Sampler
) -> Result<Self, TextureError> where
C: GraphicsContext,
Create a new texture.
- The
mipmaps
parameter must be set to0
if you want only one “layer of texels”. creating a texture without any layer wouldn’t make any sense, so if you want three layers, you will want the base layer plus two mipmaps layers: you will then pass2
as value here. - The
sampler
parameter allows to customize the way the texture will be sampled in shader stages. Refer to the documentation ofSampler
for further details.
pub fn into_raw(self) -> RawTexture
[src]
Convert a texture to its raw representation.
pub fn mipmaps(&self) -> usize
[src]
Number of mipmaps in the texture.
pub fn clear_part(
&self,
gen_mipmaps: GenMipmaps,
offset: D::Offset,
size: D::Size,
pixel: P::Encoding
) -> Result<(), TextureError> where
P::Encoding: Copy,
[src]
&self,
gen_mipmaps: GenMipmaps,
offset: D::Offset,
size: D::Size,
pixel: P::Encoding
) -> Result<(), TextureError> where
P::Encoding: Copy,
Clear a part of a texture.
The part being cleared is defined by a rectangle in which the offset
represents the
left-upper corner and the size
gives the dimension of the rectangle. All the covered texels
by this rectangle will be cleared to the pixel
value.
pub fn clear(
&self,
gen_mipmaps: GenMipmaps,
pixel: P::Encoding
) -> Result<(), TextureError> where
P::Encoding: Copy,
[src]
&self,
gen_mipmaps: GenMipmaps,
pixel: P::Encoding
) -> Result<(), TextureError> where
P::Encoding: Copy,
Clear a whole texture with a pixel
value.
pub fn upload_part(
&self,
gen_mipmaps: GenMipmaps,
offset: D::Offset,
size: D::Size,
texels: &[P::Encoding]
) -> Result<(), TextureError>
[src]
&self,
gen_mipmaps: GenMipmaps,
offset: D::Offset,
size: D::Size,
texels: &[P::Encoding]
) -> Result<(), TextureError>
Upload texels to a part of a texture.
The part being updated is defined by a rectangle in which the offset
represents the
left-upper corner and the size
gives the dimension of the rectangle. All the covered texels
by this rectangle will be updated by the texels
slice.
pub fn upload(
&self,
gen_mipmaps: GenMipmaps,
texels: &[P::Encoding]
) -> Result<(), TextureError>
[src]
&self,
gen_mipmaps: GenMipmaps,
texels: &[P::Encoding]
) -> Result<(), TextureError>
Upload texels
to the whole texture.
pub fn upload_part_raw(
&self,
gen_mipmaps: GenMipmaps,
offset: D::Offset,
size: D::Size,
texels: &[P::RawEncoding]
) -> Result<(), TextureError>
[src]
&self,
gen_mipmaps: GenMipmaps,
offset: D::Offset,
size: D::Size,
texels: &[P::RawEncoding]
) -> Result<(), TextureError>
Upload raw texels
to a part of a texture.
This function is similar to upload_part
but it works on P::RawEncoding
instead of
P::Encoding
. This useful when the texels are represented as a contiguous array of raw
components of the texels.
pub fn upload_raw(
&self,
gen_mipmaps: GenMipmaps,
texels: &[P::RawEncoding]
) -> Result<(), TextureError>
[src]
&self,
gen_mipmaps: GenMipmaps,
texels: &[P::RawEncoding]
) -> Result<(), TextureError>
Upload raw texels
to the whole texture.
pub fn get_raw_texels(&self) -> Vec<P::RawEncoding> where
P: Pixel,
P::RawEncoding: Copy + Default,
[src]
P: Pixel,
P::RawEncoding: Copy + Default,
Get the raw texels associated with this texture.
pub fn size(&self) -> D::Size
[src]
Get the inner size of the texture.
That value represents the dimension of the texture. Depending on the type of texture, its dimensionality varies. For instance:
- 1D textures have a single value, giving the length of the texture.
- 2D textures have two values for their width and height.
- 3D textures have three values: width, height and depth.
- Etc. etc.
Trait Implementations
impl<L, D, P> Drop for Texture<L, D, P> where
L: Layerable,
D: Dimensionable,
P: Pixel,
[src]
L: Layerable,
D: Dimensionable,
P: Pixel,
impl<L, D, P> DerefMut for Texture<L, D, P> where
L: Layerable,
D: Dimensionable,
P: Pixel,
[src]
L: Layerable,
D: Dimensionable,
P: Pixel,
impl<L, D, P> Deref for Texture<L, D, P> where
L: Layerable,
D: Dimensionable,
P: Pixel,
[src]
L: Layerable,
D: Dimensionable,
P: Pixel,
type Target = RawTexture
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
Auto Trait Implementations
impl<L, D, P> !Send for Texture<L, D, P>
impl<L, D, P> Unpin for Texture<L, D, P> where
L: Unpin,
P: Unpin,
<D as Dimensionable>::Size: Unpin,
L: Unpin,
P: Unpin,
<D as Dimensionable>::Size: Unpin,
impl<L, D, P> !Sync for Texture<L, D, P>
impl<L, D, P> !RefUnwindSafe for Texture<L, D, P>
impl<L, D, P> !UnwindSafe for Texture<L, D, P>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,