pub struct ImageTexture {
pub name: Option<String>,
pub usage: Option<TextureUsage>,
pub width: u32,
pub height: u32,
pub depth: u32,
pub view_dimension: ViewDimension,
pub image_format: ImageFormat,
pub mipmap_count: u32,
pub image_data: Vec<u8>,
}Fields§
§name: Option<String>An optional name assigned to some textures. This will typically be None and can not be used for reliably identifying textures.
usage: Option<TextureUsage>Hints on how the texture is used. Actual usage is determined by the shader code.
width: u32The width of the base mip level in pixels.
height: u32The height of the base mip level in pixels.
depth: u32The depth of the base mip level in pixels.
view_dimension: ViewDimension§image_format: ImageFormat§mipmap_count: u32The number of mip levels or 1 if there are no mipmaps.
image_data: Vec<u8>The combined image surface data in a standard row-major layout.
Ordered as Layer 0 Mip 0, Layer 0 Mip 1, ... Layer L-1 Mip M-1
for L layers and M mipmaps similar to DDS files.
Implementations§
Source§impl ImageTexture
impl ImageTexture
Sourcepub fn from_mibl(
mibl: &Mibl,
name: Option<String>,
usage: Option<TextureUsage>,
) -> Result<Self, CreateImageTextureError>
pub fn from_mibl( mibl: &Mibl, name: Option<String>, usage: Option<TextureUsage>, ) -> Result<Self, CreateImageTextureError>
Deswizzle the data from mibl.
The name is not required but creates more descriptive file names and debug information.
The usage improves the accuracy of texture assignments if the shader database is not specified.
Sourcepub fn from_mtxt(
mtxt: &Mtxt,
name: Option<String>,
usage: Option<TextureUsage>,
) -> Result<Self, CreateImageTextureError>
pub fn from_mtxt( mtxt: &Mtxt, name: Option<String>, usage: Option<TextureUsage>, ) -> Result<Self, CreateImageTextureError>
Deswizzle the data from mtxt.
The name is not required but creates more descriptive file names and debug information.
The usage improves the accuracy of texture assignments if the shader database is not specified.
Sourcepub fn to_image(&self) -> Result<RgbaImage, CreateImageError>
pub fn to_image(&self) -> Result<RgbaImage, CreateImageError>
Decode the first mip level for all depth slices and array layers to RGBA8.
Sourcepub fn to_surface(&self) -> Surface<&[u8]>
pub fn to_surface(&self) -> Surface<&[u8]>
Create a view of all image data in this texture to use with encode or decode operations.
pub fn to_dds(&self) -> Result<Dds, CreateDdsError>
pub fn from_surface<T: AsRef<[u8]>>( surface: Surface<T>, name: Option<String>, usage: Option<TextureUsage>, ) -> Result<Self, CreateImageTextureError>
pub fn from_dds( dds: &Dds, name: Option<String>, usage: Option<TextureUsage>, ) -> Result<Self, CreateImageTextureError>
pub fn to_mibl(&self) -> Result<Mibl, CreateMiblError>
Trait Implementations§
Source§impl Clone for ImageTexture
impl Clone for ImageTexture
Source§fn clone(&self) -> ImageTexture
fn clone(&self) -> ImageTexture
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ImageTexture
impl Debug for ImageTexture
Source§impl PartialEq for ImageTexture
impl PartialEq for ImageTexture
impl StructuralPartialEq for ImageTexture
Auto Trait Implementations§
impl Freeze for ImageTexture
impl RefUnwindSafe for ImageTexture
impl Send for ImageTexture
impl Sync for ImageTexture
impl Unpin for ImageTexture
impl UnwindSafe for ImageTexture
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more