SubtreeReader

Decodes 3D Tiles 1.1 .subtree binary files into Subtree availability tables. Consumed by the implicit-tiling expansion pass when it encounters a tile whose subtree URI template has resolved to a fetched payload.

Spec: https://github.com/CesiumGS/3d-tiles/tree/main/specification/ImplicitTiling#subtrees.

Wire format (header is 24 bytes, little-endian):

  • bytes 0..3: magic "subt" (0x73 0x75 0x62 0x74)

  • bytes 4..7: version (uint32, 1)

  • bytes 8..15: JSON byte length (uint64)

  • bytes 16..23: binary byte length (uint64)

  • JSON chunk: describes which bytes of the binary chunk hold which bitstream + any inline constants (all-available shorthand)

  • binary chunk: packed availability bits, little-endian within bytes

Functions

Link copied to clipboard
fun parse(bytes: ByteArray, subdivisionScheme: SubdivisionScheme, subtreeLevels: Int): Subtree

Parse one .subtree payload. Throws IllegalArgumentException when the header magic / version don't match the spec — easier to surface that early than to silently produce empty bitstreams the traversal code can't distinguish from "everything absent".