Skip to main content

Texture

Struct Texture 

Source
pub struct Texture {
    pub raw: RawTexture,
    pub bind_group: BindGroup,
}
Expand description

Texture with a bind group.

This is the typical texture object to be used, as the bind group is needed for applying the texture to rendered objects.

Fields§

§raw: RawTexture§bind_group: BindGroup

Implementations§

Source§

impl Texture

Source

pub fn update_texture( self, device: &Device, queue: &Queue, bind_group_layout: &BindGroupLayout, rgba: &[u8], height: usize, ) -> Result<Self>

Update the texture with new image.

This function will update the existing buffers if the dimensions match, or create new buffers with new dimensions.

§Arguments
  • device - Device of the texture. Must match the original one.
  • queue - Command queue for writing the data. Must match the original one.
  • bind_group_layout - Layout for binding this texture to a shader. Must match the original one.
  • rgba - New image data.
  • height - Height of this image.
Source

pub fn from_rgba_frame( device: &Device, queue: &Queue, bind_group_layout: &BindGroupLayout, label: Option<&'static str>, rgba: &[u8], height: usize, ) -> Result<Self>

Create a texture from RGBA image.

§Arguments
  • device - Device to create the texture on.
  • queue - Command queue to write the texture through.
  • bind_group_layout - Layout for binding this texture.
  • label - Optional identification label.
  • rgba - Image data.
  • height - Height of the texture.

Methods from Deref<Target = RawTexture>§

Source

pub const DEPTH_FORMAT: TextureFormat = wgpu::TextureFormat::Depth32Float

Trait Implementations§

Source§

impl Deref for Texture

Source§

type Target = RawTexture

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>