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: BindGroupImplementations§
Source§impl Texture
impl Texture
Sourcepub fn update_texture(
self,
device: &Device,
queue: &Queue,
bind_group_layout: &BindGroupLayout,
rgba: &[u8],
height: usize,
) -> Result<Self>
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.
Sourcepub fn from_rgba_frame(
device: &Device,
queue: &Queue,
bind_group_layout: &BindGroupLayout,
label: Option<&'static str>,
rgba: &[u8],
height: usize,
) -> Result<Self>
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>§
pub const DEPTH_FORMAT: TextureFormat = wgpu::TextureFormat::Depth32Float
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Texture
impl !UnwindSafe for Texture
impl Freeze for Texture
impl Send for Texture
impl Sync for Texture
impl Unpin for Texture
impl UnsafeUnpin for Texture
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.