SparseTexture

Struct SparseTexture 

Source
pub struct SparseTexture {
    pub m_ColorSpace: i32,
    pub m_Format: i64,
    pub m_Height: i32,
    pub m_MipCount: i32,
    pub m_Name: String,
    pub m_TextureSettings: GLTextureSettings,
    pub m_Width: i32,
    pub m_DownscaleFallback: Option<bool>,
    pub m_ForcedFallbackFormat: Option<i32>,
    pub m_IsAlphaChannelOptional: Option<bool>,
}
Expand description

SparseTexture is a class of the Unity engine since version 4.5.0. Exert from Unity’s scripting documentation: Class for handling Sparse Textures. Sparse textures are textures where not the whole texture data can be present in memory at once. They are also commonly called “tiled textures” or “mega textures”.Imagine a 16384x16384 texture at 32 bits per pixel - it would take 1GB of memory. The texture is broken down into rectangular “tiles”, and each tile can either be present in memory or not. You can load & unload these tiles as needed based on distance from the camera, sectors of the world that the player has to see, etc.Otherwise, the sparse textures behave just like any other texture in shaders - they can have mipmaps, can use all texture filtering modes, etc. If you happen to read from a tile that’s not present, you can get undefined result (on many GPUs the result is a black color, but that’s not guaranteed).Not all hardware and platforms support sparse textures, so you should check SystemInfo.supportsSparseTextures before using them. For example, on DirectX systems they require DX11.2 (Windows 8.1) and a fairly recent GPU; and on OpenGL they require ARB_sparse_texture extension support. Sparse textures only support non-compressed texture formats.After creating the sparse texture, query the tile size with tileWidth & tileHeight. Tile sizes are platform and GPU dependent.Use UpdateTile or UpdateTileRaw to make a tile resident in memory and update its color data. Use UnloadTile to unload a tile.See Also: Sparse Textures.

Fields§

§m_ColorSpace: i32§m_Format: i64§m_Height: i32

Height of the Texture in pixels (Read Only).

§m_MipCount: i32§m_Name: String

The name of the object.

§m_TextureSettings: GLTextureSettings§m_Width: i32

Width of the Texture in pixels (Read Only).

§m_DownscaleFallback: Option<bool>

bool: (2017.3.0b1 - 2022.3.2f1)

§m_ForcedFallbackFormat: Option<i32>

i32: (2017.3.0b1 - 2022.3.2f1)

§m_IsAlphaChannelOptional: Option<bool>

bool: (2020.2.0b1 - 2022.3.2f1)

Trait Implementations§

Source§

impl Debug for SparseTexture

Source§

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

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

impl<'de> Deserialize<'de> for SparseTexture

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for SparseTexture

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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<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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,