pub struct Texture2D {Show 20 fields
pub name: String,
pub width: i32,
pub height: i32,
pub complete_image_size: i32,
pub format: TextureFormat,
pub mip_map: bool,
pub mip_count: i32,
pub is_readable: bool,
pub image_count: i32,
pub texture_dimension: i32,
pub light_map_format: i32,
pub color_space: i32,
pub data_size: i32,
pub stream_info: StreamingInfo,
pub texture_settings: GLTextureSettings,
pub image_data: Vec<u8>,
pub forced_fallback_format: Option<i32>,
pub downscale_fallback: Option<bool>,
pub is_alpha_channel_optional: Option<bool>,
pub mips_stripped: Option<i32>,
}Expand description
Texture2D object representation
This structure contains all the data needed to represent a Unity Texture2D object. It includes both metadata and the actual image data.
Fields§
§name: String§width: i32§height: i32§complete_image_size: i32§format: TextureFormat§mip_map: bool§mip_count: i32§is_readable: bool§image_count: i32§texture_dimension: i32§light_map_format: i32§color_space: i32§data_size: i32§stream_info: StreamingInfo§texture_settings: GLTextureSettings§image_data: Vec<u8>§forced_fallback_format: Option<i32>§downscale_fallback: Option<bool>§is_alpha_channel_optional: Option<bool>§mips_stripped: Option<i32>Implementations§
Source§impl Texture2D
impl Texture2D
Sourcepub fn new(name: String, width: i32, height: i32, format: TextureFormat) -> Self
pub fn new(name: String, width: i32, height: i32, format: TextureFormat) -> Self
Create a new Texture2D with basic parameters
Sourcepub fn has_valid_dimensions(&self) -> bool
pub fn has_valid_dimensions(&self) -> bool
Check if texture has valid dimensions
Sourcepub fn has_image_data(&self) -> bool
pub fn has_image_data(&self) -> bool
Check if texture has image data
Sourcepub fn dimensions(&self) -> (u32, u32)
pub fn dimensions(&self) -> (u32, u32)
Get texture dimensions as tuple
Sourcepub fn is_streamed(&self) -> bool
pub fn is_streamed(&self) -> bool
Check if texture uses external streaming
Sourcepub fn expected_data_size(&self) -> u32
pub fn expected_data_size(&self) -> u32
Get expected data size based on format and dimensions
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Texture2D
impl<'de> Deserialize<'de> for Texture2D
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Texture2D
impl RefUnwindSafe for Texture2D
impl Send for Texture2D
impl Sync for Texture2D
impl Unpin for Texture2D
impl UnwindSafe for Texture2D
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> 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>
Converts
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>
Converts
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().