Class KtxReaderOptions
Options for reading KTX and KTX 2.
public sealed record KtxReaderOptions : ReaderOptions, IEquatable<ReaderOptions>, IEquatable<KtxReaderOptions>
- Inheritance
-
KtxReaderOptions
- Implements
- Inherited Members
Examples
// One surface and mip: cube face -Y (faces go +X, -X, +Y, -Y, +Z, -Z), second mip if it has one.
using Raster face = Raster.Load("sky.ktx2", context, new KtxReaderOptions { Surface = 3 });
// Every face at mip 0, or with every mip after its face.
using RasterList faces = Raster.LoadAll("sky.ktx2", context);
using RasterList all = Raster.LoadAll("texture.ktx2", context, new KtxReaderOptions { IncludeMipLevels = true });
// The pixels as the file stores them: no KTXorientation flip and no KTXswizzle.
using Raster stored = Raster.Load("texture.ktx2", context, new KtxReaderOptions { KeepStoredLayout = true });
Properties
IncludeMipLevels
Gets whether LoadAll also returns every mip level, each after the surface it belongs to. Defaults to false: mip 0 of each surface only.
public bool IncludeMipLevels { get; init; }
Property Value
KeepStoredLayout
Gets whether rows, columns and channels come out as stored, without the file's orientation and swizzle applied. Defaults to false: textures come out top-down with the swizzle applied. KtxDetails keeps both either way.
public bool KeepStoredLayout { get; init; }
Property Value
MipLevel
Gets the mip level Load returns, or null (the default) for mip 0, or the smallest that covers
MinimumSize. A volume's depth slice at mip m is slice slice >> m of that mip.
public int? MipLevel { get; init; }
Property Value
- int?
Exceptions
- ArgumentOutOfRangeException
The value is negative.
ReconstructNormalZ
Gets whether a two-channel normal map (BC5, R8G8, R16G16) gets its blue channel rebuilt as the normal's Z, sqrt(1 − x² − y²), instead of 0. Defaults to false.
public bool ReconstructNormalZ { get; init; }
Property Value
Surface
Gets the surface Load returns, or null (the default) for the first. Surfaces count layer-major, then
face (+X, −X, +Y, −Y, +Z, −Z), then depth slice: surface (layer × faces + face) × depth + slice.
public int? Surface { get; init; }
Property Value
- int?
Exceptions
- ArgumentOutOfRangeException
The value is negative.