pub struct UnityTexture {
pub name: String,
pub width: u32,
pub height: u32,
pub format: i64,
pub mips: u32,
pub srgb: bool,
pub usage: i64,
pub wrap: [i64; 2],
pub filter: i64,
pub mip_bias: f32,
pub aniso: i64,
pub data: Vec<u8>,
}Expand description
A Texture2D as stored.
Fields§
§name: Stringm_Name.
width: u32Width in pixels of the largest level.
height: u32Height in pixels of the largest level.
format: i64Unity’s TextureFormat id.
mips: u32m_MipCount: how many levels data holds.
srgb: boolm_ColorSpace 1: sampled as sRGB.
usage: i64Unity’s TextureUsageMode (m_LightmapFormat).
wrap: [i64; 2]TextureWrapMode along u and v (0 repeat, 1 clamp, 2 mirror, 3 mirror once).
filter: i64FilterMode (0 point, 1 bilinear, 2 trilinear).
mip_bias: f32m_MipBias: added to the level of detail the texture is sampled at.
aniso: i64m_Aniso: the anisotropic filtering level (above 1: anisotropic).
data: Vec<u8>All levels, largest first, bottom row first.
Implementations§
Source§impl UnityTexture
impl UnityTexture
Sourcepub fn read(player: &Player, r: &ObjRef) -> Result<Self>
pub fn read(player: &Player, r: &ObjRef) -> Result<Self>
Read the Texture2D r of player (its pixels in the object or streamed beside its file).
Sourcepub fn levels(&self) -> Result<(TextureFormat, Vec<&[u8]>)>
pub fn levels(&self) -> Result<(TextureFormat, Vec<&[u8]>)>
The mip chain split into its levels, largest first, each as stored (bottom row first), with the format the texture id names. Every size is checked: no more levels than halvings of a 32-bit side, no level whose size overflows or runs past the data, no data left over.