Skip to content
Brass Orrery

Orrery Terrain · OrreryTerrainCore · namespace

OrreryTerrain::

Native

Declared in OrreryTerrainCore. Its members are listed below, by kind.

Types

Functions

Constants

NameTypeDefaultMeaning
kBrushMaskMinSideExperimentaluint32_t8

The smallest side of a brush mask, in samples.

kBrushMaskMaxSideExperimentaluint32_t2048

The largest side of a brush mask, in samples (a 16-bit mask of this side holds 8 MiB of samples).

kBrushMaskFormatVersionExperimentaluint8_t1

The canonical bytes' format version, written after the magic.

kBrushMaskHeaderBytesExperimentalsize_t8

Bytes of the canonical header: the magic 'TSBM', the format version (1 byte), the bits (1 byte) and the side (2 bytes, little-endian).

kBrushMaskOneExperimentalint64_t65536

A mask value of 1 (a white sample) in Q16: every sample becomes M in [0, kBrushMaskOne].

kBrushMaskMaxRadius_mmExperimentaluint32_t1u << 30

The largest FBrush::Radius_mm a mask is sampled at, 2^30 mm (about 1,074 km), so the sampler's products fit 64 bits; a larger masked brush writes nothing.

kBrushMaskScaleShiftExperimentalint32_t32

The fixed-point shift of FBrushMaskDab::ScaleX and ScaleY (samples per Q16 millimetre).

kBrushMaskInvShiftExperimentalint32_t46

The fixed-point shift of FBrushMaskDab::InvHalfX and InvHalfY (1 over a half-side in mm).

kBrushMaskOutsideExperimentalint32_t-1

What SampleBrushMaskRow writes for a post off the mask's rectangle (where FBrushMaskDab::Local answers false).

kBrushMaskDefaultBudgetExperimentaluint64_tuint64_t(64) << 20

FBrushMaskRegistry's default byte budget, 64 MiB: six 2048² masks with their mips, or about 380 of 256² (samples are held as 16-bit unorm).

kFarAllLevelsuint16_t0xFFFF

Every far level: FGroundChange::Levels of a change to the truth.

kGroundJournalCapacitysize_t4096

Entries the ground journal keeps: a reader more entries behind than this resets (FGroundQuery::ChangesSince).

kFarJournalCapacitysize_t1024

Far entries (Levels != 0) FTerrainWorld::FarChanges keeps: a far reader more far entries behind than this resets.

kFarJournalMaxPerPublishsize_t64

Far rectangles one publish adds at most; more changed tiles coalesce into bounding rectangles.

kSyncFieldSculptExperimentaluint32_t0x10000u

The field of a SyncHash leaf: a paint channel is its own FChannelId (below 0x10000); the sculpt layer is kSyncFieldSculpt.

A new authoritative field takes a new id, so it joins the checks without a format change.

kNetBatchContextsExperimentaluint32_t16

Stroke contexts a batch stream keeps: a switch back to one of these costs one byte.

kJoinStreamVersionExperimentaluint16_t6

Version of the join stream's framing and head.

A reader refuses any other: a head frame at another version is EJoinStreamError::BadVersion, found before the frame's hash (which the versions compute differently). Version 1: one open stroke. Version 2: every open stroke, one per author. Version 3: frame hashes H5, the head carries PageTiles, the save is version 5. Version 4: an open stroke's tile says whether it has Flatten start heights (FJoinStrokeTile::Start), and each start travels in its own chunk right after the head. Version 5: the head lists brush masks (FJoinHead::Masks), and each travels in its own frame after the start chunks; it ends with the authority's sculpt limits (FJoinHead::Limits), which the joiner's replica applies records under. Version 6: the head's flags say how the joiner's kept save is used (FJoinHead::CacheUse), and such a stream leaves out the bytes the joiner holds.

kJoinMaxMaskBytesExperimentaluint64_tuint64_t(32) << 20

The most canonical brush mask bytes one join carries (FJoinHead::Masks), 32 MiB: three 16-bit 2048² masks (8 MiB and 8 bytes each), or 512 8-bit 256² ones.

A writer whose masks hold more refuses the join (EJoinWrite::MasksTooLarge); a reader refuses a head that lists more.

kJoinFrameBytesExperimentaluint32_t64u * 1024u

The most save bytes one frame carries; the transport cuts the stream wherever it likes (ClientJoinChunk, at most 32 KB).

kJoinMaxHeadBytesExperimentaluint32_t16u << 20

The largest head a reader accepts, bytes.

The open strokes' tiles are most of it, 14 bytes each, so it holds about 1.2 million stroke tiles. A writer whose head would be larger refuses the join (EJoinWrite::HeadTooLarge).

kJoinMaxStartBytesExperimentaluint32_t8u + 5u * uint32_t(kTilePosts) * uint32_t(kTilePosts)

The largest start chunk a reader accepts, bytes: its stroke and tile index, then the tile's kTilePosts² posts as zigzag varints of their residual from a plane through their neighbours.

An int32 post's residual is under 2^33 in magnitude, so it takes at most 5 bytes and every start fits by construction.

kTerrainServerAuthorExperimentalFTerrainAuthor0

The author of the server's or the listen host's own edits.

kTerrainNetVersionExperimentaluint16_t6

Version of the net record format: the envelope, the payloads below and the batch codec (NetBatch.h).

Bumped on any change of layout or meaning. The Hello compares it, kSculptRecordVersion and the save version (CheckNetVersions), so two builds that would code or apply a record differently never connect. Version 1: the first. Version 2: records unchanged, but a late join travels as the join stream (NetJoin.h, kJoinStreamVersion 2) instead of save bytes, so a version-1 peer is refused at the Hello rather than failing its join. Version 3 (the v1.0 format freeze): the join stream is version 3 and carries a version-5 save, so a version-2 peer is refused at the Hello. Version 4: a Flatten record blends toward its plane by brush weight from the stroke's start, so it writes other posts than before, and the join stream (version 4) carries that start. Version 5 (brush masks and height stamps): the BrushMask record, the Hello's held-mask list, the batch's mask fields (NetBatch.h) and the join stream's mask frames (version 5); sculpt records are version 5 as well. Still version 5, before any release: the request-only MaskUpload kind, a client's brush mask upload. Version 6 (a reconnect's kept save): record layouts unchanged, but the Hello names the save a client kept, the client answers which codes it holds, and the join stream is version 6, so a version-5 peer is refused at the Hello rather than failing its join.

kNetMaxPayloadBytesExperimentalsize_tsize_t(1) << 26

The largest payload a record may carry, 64 MiB.

A link further behind than FNetLogLimits::MaxLagBytes rejoins long before.

kNetRecordHeaderBytesExperimentalsize_t19

Bytes of a record's envelope before its payload: version 2, kind 1, seq 8, author 4, payload size 4.

kNetCheckpointBytesExperimentalsize_t24

Bytes of a Checkpoint payload.

kNetResetBytesExperimentalsize_t16

Bytes of a Reset payload.

kNetBrushMaskHashOnlyBytesExperimentalsize_t12

Bytes of a BrushMask payload that names its mask by hash only: U64 hash, U32 canonical size.

kNetMaskUploadHeaderBytesExperimentalsize_t20

Bytes of a MaskUpload payload before its chunk: U64 hash, U32 canonical size, U32 total, U32 offset.

kNetMaskUploadChunkBytesExperimentalsize_tsize_t(16) << 10

The most upload bytes one MaskUpload part carries, 16 KiB: half of the largest transport part (kTerrainNetMaxPartBytes, 32 KiB), so a request batch part holds a chunk and the brush steps beside it.

kRepairMessageVersionExperimentaluint16_t1

Version of the repair messages (leaves and request).

A decoder refuses any other (BadVersion).

kSculptRecordVersionExperimentaluint16_t5

Version of the sculpt record format (commands and patches), written first on the wire.

Bumped on any change of layout or meaning. A decoder refuses a version it does not know, so a replica of another build never applies a stroke differently. Older records back to kSculptRecordOldestVersion still decode: a decoder upgrades them to the current version with the newer fields at their defaults, and they replay as they did before. A version 3 record's paint steps run the list kernel, and a PaintChannel step on the retired paint channels (1, 2) is then refused (UnknownChannel).

kSculptRecordOldestVersionExperimentaluint16_t2

The oldest record version a decoder still reads; it upgrades it to kSculptRecordVersion.

kSculptCommandBytesExperimentalsize_t72

Bytes of one encoded FSculptCommand: version 2, kind 1, brush kind 1, falloff 1, channel value 1, channel 2, stroke 8, step 4, centre 8 + 8, radius 4, strength 4, flatten-to 4, then (version 3 on) falloff start 2, flatten direction 1, paint layer 1, paint opacity 1, then (version 5) mask hash 8, mask angle 2, mask flags 1, stamp blend 1, mask aspect 2 and 5 zero bytes.

Little-endian, every field always written.

kSculptCommandBytesV4Experimentalsize_t56

Bytes of a version 3 or 4 command: the first 53 of the version 5 layout, then 3 zero bytes.

kSculptCommandBytesV2Experimentalsize_t48

Bytes of a version 2 command: the first 48 of the version 3 layout.

kSculptMaxCentre_mmExperimentalint64_tint64_t(1) << 60

Largest |Brush.CentreX_mm| and |Brush.CentreY_mm| a record may carry: about 10^15 m, far beyond any terrain.

kGroundClassesint32_t8

Ground classes a cell can carry: the rows of FBatterTable and of the shell's physical material table.

Class 0 is the default soil.

kHoleClassuint8_t0xFF

Ground-class value that marks a hole: a cell under a mesh feature (portal, cut-and-cover), skipped by collision and navigation.

Equal to the shell's kTerrainHoleClass.

kMaxPaintSlotsint32_t8

Paint slots a post can hold in the format: the layer planes are ids 16-23 and the weight planes 24-30.

kTerrainCostCountint32_tstatic_cast<int32_t>(ETerrainCost::Count)

Number of counters, for arrays passed to DrainTerrainCosts.

GTerrainCostCollectingstd::atomic<uint32_t>—

Nonzero while the counters collect.

Written by SetTerrainCostCollecting; read by every scope.

kBrushMaskMirroruint8_t1u << 0

FBrush::MaskFlags: the mask is mirrored left to right (its columns reversed) in the brush's own frame, before the rotation.

kBrushMaskSquareuint8_t1u << 1

FBrush::MaskFlags: the footprint is the mask's own rectangle, rotated with it, corners included, instead of the disc that clips it.

kBrushMaskBicubicuint8_t1u << 2

FBrush::MaskFlags: the mask is sampled bicubically (fixed point, integer only) instead of bilinearly.

kBrushMaskKnownFlagsuint8_tkBrushMaskMirror | kBrushMaskSquare | kBrushMaskBicubic

Every FBrush::MaskFlags bit record version 5 defines; a record with any other bit set is refused.

kBrushAspectSquareuint16_t256

FBrush::MaskAspect_q8 of a square mask: width over height 1:1, in 1/256.

kBrushAngleTurnuint32_t65536

FBrush::MaskAngle of a whole turn: the angle counts 1/65536 of a turn (about 0.0055°).

kFalloffStartOneuint32_t65536

FBrush::FalloffStart_q16 of the whole radius: the start is a fraction of the radius in 1/65536.

kMaxFalloffStart_q16uint16_t65535

The largest falloff start a brush carries, 65535/65536 of the radius.

kMaxOpeningsPerCorridorsize_t64

Most openings one corridor may state (FTerrainWorld refuses more as InvalidFeature).

kMaxOutlinePointssize_t256

Most points one opening's outline may hold.

kScatterSubCellsPerSideExperimentalint32_t4

Sub-cells per chunk side: a 128-post chunk (127 quads) splits into 4 × 4 sub-cells of 32 quads (the last 31).

kScatterSubCellQuadsExperimentalint32_t32

Quads per sub-cell side (the last sub-cell of a row or column takes the remainder).

kScatterSubCellsExperimentalint32_tkScatterSubCellsPerSide * kScatterSubCellsPerSide

Sub-cells per chunk; a dirty set is a uint16_t with bit SubY * 4 + SubX.

kScatterLayersExperimentalint32_tkPaintLayerIds

Paint layer ids a post can name (8-bit ids, PaintSlots.h).

kScatterMaxAutoRulesExperimentalint32_t5

Auto rules the material evaluates (the material's AutoRule0..4).

kScatterMaskSizeExperimentalint32_t64

Keep-clear mask cells per sub-cell side: 0.5 m at 1 m posts.

kScatterMaskDistStepCmExperimentaldouble25.0

Keep-clear distance unit, cm (FScatterKeepClear::MarginDistQ).

kScatterLayersFormulaHashExperimentaluint64_t0x1644A8D5E4E7861Bull

The material formula EffectiveLayerWeights ports: 64-bit FNV-1a of the UTF-8 bytes of MF_TerrainLayers' Custom node code from the first "float W0 = 1.0;" to the end of the first "EW[0] = W0 * Rem;", carriage returns removed (the painted bilinear of slots 0-1, the two noise fields, the five auto rules and RockMask; chunks holding texture 2 redo the bilinear with slots 2-3 in one branch after the block, which this hash does not cover).

Orrery.Terrain.Scatter.Weights.EffectiveParity recomputes it from the asset: when it fails, port the change into EffectiveLayerWeights and update this value.

kOwnerDomainRailuint32_tFourCC('R', 'A', 'I', 'L')

The owner domains Orrery reserves (FOwnerId::Domain).

Every one is a FourCC; 0 is no owner. A buyer's own code uses any other value, by convention its own FourCC, and never one of these. Rail earthworks (RailSim's kEarthOwnerDomain, the same value).

kOwnerDomainTerrainEditoruint32_tFourCC('T', 'S', 'E', 'D')

Features authored in the terrain editor mode.

Type aliases

  • FFarChangeFGroundChange

    The far journal's entry: the ground journal's entries with Levels != 0.

  • FNetCursoruint32_t

    A cursor of FTerrainNetLog: one link or one open join.

  • FNetSequint64_t

    A record's position in the authority's log (FTerrainNetLog): 1 for the first record, 0 for none.

  • FTerrainAuthoruint32_t

    Who authored a record: kTerrainServerAuthor for the server or host, then one id per connection, stable for the session.

  • FHeightMmint32_t

    A height in integer millimetres: the authoritative, serialised and hashed unit.

  • FRevisionuint64_t

    Monotonic counter, bumped once per published change by FTerrainWorld only.

  • FFeatureIduint64_t

    Identity of a feature in the stack.

  • FStrokeIduint64_t

    Identity of a sculpt stroke, for the bounded undo ring.

  • FGroundClassuint8_t

    Ground class of a cell (rock, soil, clay…).

  • FChannelIduint16_t

    Index of a typed per-cell channel registered on the terrain (paint weights, zoning, soil…).