pub struct Texture {
pub uuid: Uuid,
pub name: Option<Cow<'static, str>>,
pub image: ImageHandle,
pub view_dimension: TextureViewDimension,
pub sampler: TextureSampler,
pub generate_mipmaps: bool,
pub color_space: ColorSpace,
}Expand description
Lightweight “glue” that pairs an Image (via
handle) with sampling, view, and colour-space configuration.
Texture is intentionally thin — the heavy pixel data lives in the
[Image] stored separately in AssetServer.images. This decoupling
enables multiple Texture assets to reference the same Image
with different colour-space or sampler settings without duplicating
the underlying pixel data.
The final wgpu::TextureFormat used on the GPU is derived at upload
time by combining the Image’s physical PixelFormat with this
texture’s color_space via
resolve_wgpu_format.
Fields§
§uuid: Uuid§name: Option<Cow<'static, str>>§image: ImageHandleHandle into AssetServer.images.
view_dimension: TextureViewDimension§sampler: TextureSampler§generate_mipmaps: bool§color_space: ColorSpaceColour-space intent — determines the sRGB / Linear GPU format variant.
Implementations§
Source§impl Texture
impl Texture
Sourcepub fn resolve_wgpu_format(&self, image_format: PixelFormat) -> TextureFormat
pub fn resolve_wgpu_format(&self, image_format: PixelFormat) -> TextureFormat
Resolves the final wgpu::TextureFormat by combining the image’s
physical pixel layout with this texture’s colour-space intent.
Sourcepub fn new(
name: Option<&str>,
image: ImageHandle,
view_dimension: TextureViewDimension,
) -> Texture
pub fn new( name: Option<&str>, image: ImageHandle, view_dimension: TextureViewDimension, ) -> Texture
Creates a Texture referencing the given image handle.
Sourcepub fn new_2d(name: Option<&str>, image: ImageHandle) -> Texture
pub fn new_2d(name: Option<&str>, image: ImageHandle) -> Texture
Convenience: creates a 2D texture referencing the given image handle.
Sourcepub fn new_3d(name: Option<&str>, image: ImageHandle) -> Texture
pub fn new_3d(name: Option<&str>, image: ImageHandle) -> Texture
Convenience: creates a 3D texture (e.g. LUT) referencing the given handle.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Texture
impl RefUnwindSafe for Texture
impl Send for Texture
impl Sync for Texture
impl Unpin for Texture
impl UnsafeUnpin for Texture
impl UnwindSafe 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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.