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)