Skip to content

Class Ktx2Writer

Namespace: Apogee.Content.Import
Assembly: Apogee.Content.dll

Writes a 2D texture of 8-bit RGBA with its mip chain as a KTX 2 file, uncompressed (supercompressionScheme 0): the header, the level index, a data format descriptor that says what the bytes are (RGBA, sRGB or linear), and the levels, smallest first as the format requires. reads it back; so does any KTX 2 tool. With zstdLevel each level is compressed with zstd (supercompressionScheme 2, which libktx inflates when it loads): the file is smaller, the texture the same. This is not GPU texture compression: the texture is RGBA8 in memory and on the GPU. That is ; this writer is for compression="none" and for textures too small to compress.

public static class Ktx2Writer

Inheritance

object ← Ktx2Writer

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Fields

ImportLevel

The zstd level the importer compresses textures with: good ratio, and fast enough for big textures.

public const int ImportLevel = 9

Field Value

int

Methods

Write(TextureData, int)

public static byte[] Write(TextureData texture, int zstdLevel = 0)

Parameters

texture TextureData

zstdLevel int

Returns

byte[]

Exceptions

ContentException

The texture is not RGBA8, or its levels are not the sizes of a mip chain.