Interface ITileBlockCodec
- Namespace
- LansMap.Core.TileCodecs
Write and transcode half for a GPU-ready block-compressed tile format, on top of ITileCodec's read half.
public interface ITileBlockCodec : ITileCodec
- Inherited Members
Properties
Id
Stable lowercase identifier for this codec, for example "bc1", "etc2", or "astc4x4".
string Id { get; }
Property Value
Remarks
Serialized scenes carry this string. Do not localize it, and do not change the spelling once shipped. One id is one GPU block format including its parameters: a family such as ASTC ships as separate ids ("astc4x4", "astc6x6"), never a bare "astc".
Methods
DecodeLevel(byte[], int, int, int, byte[], int)
Decodes one already-extracted mip level's raw blocks back to RGBA8888.
void DecodeLevel(byte[] blocks, int offset, int width, int height, byte[] outRgba, int outOffset)
Parameters
blocksbyte[]Level bytes, LevelBlockBytes(int, int) readable from
offset.offsetintStart of this level in
blocks, in bytes.widthintLevel width in texels.
heightintLevel height in texels.
outRgbabyte[]Destination, widthheight4 RGBA8888 bytes row-major from
outOffset.outOffsetintStart write index in
outRgba, in bytes.
Remarks
Cache migration only needs the base level; the rest of a stored chain is discarded and rebuilt by the new codec's WritePayload(int, int, byte[], byte[], byte[], int). The default throws NotSupportedException so a codec that has not overridden this still compiles and simply skips local migration.
LevelBlockBytes(int, int)
Byte count of one mip level as raw blocks, block-rounded.
int LevelBlockBytes(int widthTexels, int heightTexels)
Parameters
Returns
- int
Size in bytes of each TryBuildMips(byte[], int, int, int, int, byte[][]) buffer for this level. A tail smaller than one block still costs one whole block.
RequiredPayloadBytes(int, int)
Byte count of one whole disk payload (header plus every mip of a full chain) for a base level of the given dimensions.
int RequiredPayloadBytes(int width, int height)
Parameters
Returns
- int
Payload size in bytes.
WritePayload(int, int, byte[], byte[], byte[], int)
Encodes base-level RGBA8888 into a full mip-chain disk payload.
int WritePayload(int width, int height, byte[] rgba, byte[] scratchRgba, byte[] outPayload, int outOffset)
Parameters
widthintBase-level width in texels.
heightintBase-level height in texels.
rgbabyte[]Base-level widthheight4 RGBA8888 bytes; a working buffer, not preserved.
scratchRgbabyte[]Caller-owned scratch of at least widthheight4 bytes; a working buffer, not preserved.
outPayloadbyte[]Caller-owned destination, at least RequiredPayloadBytes(int, int) bytes from
outOffset.outOffsetintStart write index in
outPayload, in bytes.
Returns
- int
Bytes written, equal to RequiredPayloadBytes(int, int).
Remarks
rgba and scratchRgba are
ping-pong working buffers. After return, neither holds the original
level-0 pixels. Pass a copy if you still need them.