Skip to content

Class Ktx2Loader

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

Loads KTX 2 files. Basis Universal data (ETC1S and UASTC) is transcoded to the best format the GPU samples: BC7, ASTC 4x4, or RGBA8.

public static class Ktx2Loader

Inheritance

object ← Ktx2Loader

Inherited Members

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

Properties

Magic

The file magic of a KTX 2 file («KTX 20»\r\n\x1A\n).

public static ReadOnlySpan<byte> Magic { get; }

Property Value

ReadOnlySpan<byte>

Methods

IsKtx2(ReadOnlySpan<byte>)

public static bool IsKtx2(ReadOnlySpan<byte> file)

Parameters

file ReadOnlySpan<byte>

Returns

bool

IsSrgb(string, ReadOnlySpan<byte>)

Whether the file says its colors are sRGB: the transfer function in its data format descriptor, which holds for RGBA8 and for Basis Universal data alike.

public static bool IsSrgb(string name, ReadOnlySpan<byte> file)

Parameters

name string

file ReadOnlySpan<byte>

Returns

bool

Exceptions

ContentException

It is not a readable KTX 2 file.

Load(string, ReadOnlySpan<byte>, bool, TextureCaps, SamplerData)

public static TextureData Load(string name, ReadOnlySpan<byte> file, bool srgb, TextureCaps caps, SamplerData sampler)

Parameters

name string

file ReadOnlySpan<byte>

srgb bool

Whether the colors are sRGB (base color, emissive) or linear (normals, roughness…); it picks the sampled format, whatever the file says.

caps TextureCaps

sampler SamplerData

Returns

TextureData