TextureBlob
- Namespace: Turian.Engine.Core
- Source File: TextureBlob.cs
Reads the .amtex binary texture container: a 12-byte header followed by a binary manifest chunk and a payload chunk holding the mip levels back to back. The payload is whatever the GPU samples directly — block-compressed blocks or RGBA8 texels — so loading is a header read and a set of slices.
Fields
FileExtension (string) = ".amtex": File extension of the container.
Magic (uint) = 0x58544D41: Header magic, the ASCII bytes AMTX.
Version (uint) = 1: Container version this reader accepts.
ManifestChunkType (uint) = 0x494E414D: Chunk type of the binary manifest, the ASCII bytes MANI.
PayloadChunkType (uint) = 0x004E4942: Chunk type of the payload, the ASCII bytes BIN\0.
Properties
Format
(Format) : Vulkan format of the stored levels.
Width
(uint) : Width of mip level 0.
Height
(uint) : Height of mip level 0.
IsSrgb
(bool) : Whether the data is sampled in sRGB space, as recorded at import.
Levels
(IReadOnlyList<ReadOnlyMemory[]: The mip levels, largest first. Slices over the container bytes.
Public Methods
Load
public static TextureBlob Load(string path)
Reads a texture blob from a file.
Parameters:
path(string): Absolute path of the.amtexfile.
Returns: TextureBlob
Read
public static TextureBlob Read(Stream stream)
Reads a texture blob from a stream, consuming it to the end.
Parameters:
stream(Stream): The stream positioned at the container header.
Returns: TextureBlob
Read
public static TextureBlob Read(ReadOnlyMemory<byte> data)
Reads a texture blob from an in-memory container.
Parameters:
data(ReadOnlyMemory): The complete container bytes.
Returns: TextureBlob
IsTextureBlob
public static bool IsTextureBlob(ReadOnlySpan<byte> data)
Sniffs whether data opens with the texture blob magic, so a loader can choose this path over decoding a source image format.
Parameters:
data(ReadOnlySpan): Bytes to sniff; may be shorter than a full header.
Returns: bool