Skip to content
Brass Orrery

Orrery Terrain · OrreryTerrain module · class

FOrreryTerrainTileStoreIndex

Experimental

The packed index of a tile store: where each stored tile's bytes sit in the payload.

Declaration

class FOrreryTerrainTileStoreIndex
Header
#include "OrreryTerrainTileStoreAsset.h"
Module
PublicDependencyModuleNames.Add("OrreryTerrain"); in your module’s Build.cs.
Stability
Experimental: supported, may change in a minor version, with a changelog line.
Thread
Thread-safe to read.

Description

Not reflected: it is a native blob in the asset's own serialisation, about 4 bytes a stored tile. Tiles are keyed by (field, level, tile), and each field has its own cell size and level-0 rectangle. Two fields are built: field 0, the natural ground height (and its paint), and, only when the input has one, field 1, the natural ground class: level 0 only, tiled as field 0. A store without field 1 has the bytes and the hash it had before field 1 existed.

Each level of a field is dense over its rectangle (coordinates are implicit) and cut into pages of kPageTiles × kPageTiles tiles, clipped at the rectangle's edges. Slots run field by field, level by level, page row by page row, page by page, then row-major inside a page: the payload holds the tiles in that same order. A slot is 32 bits, the stored size (24 bits) and a code byte (codec and flags); a page keeps the payload offset of its first tile, so a lookup adds at most kPageTiles² − 1 sizes and a later version can page the index by region.

Immutable once sealed; shared between the asset and its tile sources. Thread-safe to read. Tier 3 (plain C++, no UObject).

Types

  • ECodec enum

    How a stored tile's bytes (after the 8-byte tile hash every stored tile starts with) are compressed.

    Absent, Raw, Oodle

Functions

  • PaintPairsOfstatic

    The pair mask a version-2 channel block holds for index code Code: 0 without kFlagPaintSlots.

  • AddField

    Lay out one field with every slot absent.

  • FindSlot

    Slot of a tile, or -1 when the field, level or tile is outside the index.

  • SetSlot

    Set one slot before Seal.

  • Seal

    Compute the page offsets from the slot sizes, in slot order.

  • Find

    Where a tile is.

  • WriteBlob

    Write the version-1 blob (little-endian).

  • ReadBlob

    Parse and check a blob: counts equal the layout the fields imply, codes are known, the page offsets follow the sizes, and the sizes add up to PayloadSize.

  • FindField
  • GetFields
  • GetLevels
  • NumSlots
  • GetSlot
  • NumStoredTiles
  • GetPayloadSize
  • GetAllocatedBytes

    Bytes the index holds in memory (slots, pages, tables).

  • MixHashstatic

    The hash step every store hash uses (splitmix64 of H mixed with V).

Properties

NameTypeDefaultMeaning
kPageTilesint3232—
kSizeMaskuint320x00FFFFFFu—
kCodecMaskuint80x0F

Low nibble of a code: ECodec.

kFlagChannelsuint80x10

The tile carries a version-1 channel block, two planes (level 0 only; read, no longer written).

kFlagPaintSlotsuint80x20

The tile carries a version-2 channel block, the paint slot planes (level 0 only).

kFlagPaintPair1uint80x40

With kFlagPaintSlots: the block holds slot pair 1 as well as pair 0 (its pair mask is 3, not 1).

kBlobVersionuint161—