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,
}Expand description
Lightweight “glue” that pairs an Image (via
handle) with sampling and view 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 sampler or view settings, and makes the version-driven GPU
upload path straightforward.
Fields§
§uuid: Uuid§name: Option<Cow<'static, str>>§image: ImageHandleHandle into AssetServer.images.
view_dimension: TextureViewDimension§sampler: TextureSampler§generate_mipmaps: boolImplementations§
Source§impl Texture
impl Texture
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
Mutably borrows from an owned value. Read more
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.