Skip to main content

UnityTexture

Struct UnityTexture 

Source
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: String

m_Name.

§width: u32

Width in pixels of the largest level.

§height: u32

Height in pixels of the largest level.

§format: i64

Unity’s TextureFormat id.

§mips: u32

m_MipCount: how many levels data holds.

§srgb: bool

m_ColorSpace 1: sampled as sRGB.

§usage: i64

Unity’s TextureUsageMode (m_LightmapFormat).

§wrap: [i64; 2]

TextureWrapMode along u and v (0 repeat, 1 clamp, 2 mirror, 3 mirror once).

§filter: i64

FilterMode (0 point, 1 bilinear, 2 trilinear).

§mip_bias: f32

m_MipBias: added to the level of detail the texture is sampled at.

§aniso: i64

m_Aniso: the anisotropic filtering level (above 1: anisotropic).

§data: Vec<u8>

All levels, largest first, bottom row first.

Implementations§

Source§

impl UnityTexture

Source

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).

Source

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.

Trait Implementations§

Source§

impl Clone for UnityTexture

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UnityTexture

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for UnityTexture

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for UnityTexture

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.