Namespace Shard.Gameplay.Universe.World.Chunks.Palettes
Classes
- BitFieldArray
A packed array of
lengthfixed-width unsigned indices,bitseach, laid out LSB-first across a byte stream (Java:BitFieldArr). Indexi's low bit sits at bit(ibits) % 8of byte(ibits) / 8; a value that straddles a byte boundary spills its remaining high bits into the next byte starting at bit 0. Backing size isceil(length*bits / 8)bytes.
- ColumnBytePalette
A per-column palette of one value per
(x,z)cell over a 32×32 column (Java:IntBytePalettefor tints,ShortBytePalettefor heights). Distinct values are interned into a key table and each of the 1024 cells stores a 10-bit index into it (via BitFieldArray). Cell 0 defaults to key 0.The wire format is
[u16 count][count × key][i32 packedByteLength][packed indices], little-endian, with no leading type byte — height and tint are told apart by their position inSetColumn. The key width is the only difference between the two: SerializeShortKeys() (heights) vs SerializeIntKeys() (tints).