Orrery Terrain · OrreryTerrain module · struct
FTerrainChunkPosts
The heights of one chunk, read once from a published snapshot and shared, immutable, by everything downstream of the ground: the chunk's collision field and its render chunk.
Declaration
struct FTerrainChunkPosts- Header
#include "TerrainChunkPosts.h"- Module
PublicDependencyModuleNames.Add("OrreryTerrain");in your module’s Build.cs.- Stability
- Stable: changes within a major version only add.
- Thread
- Built on a task-system worker from an FGroundQuery the game thread acquired; read on any thread afterwards.
Description
A chunk is one edit-layer tile (OrreryTerrain::Native::kTilePosts² posts, edge posts duplicated with the neighbours). Positions are relative to Origin, so a chunk far from the world origin keeps full XY precision (LWC: the doubles live in Origin only).
Heights are whole millimetres of the edited ground, stored as 16-bit steps above the lowest post of their block of 8 × 8 posts; a block whose own relief passes 65.535 m keeps the steps' high 16 bits too: lossless either way. The reads answer float cm, float(double(Mm) * 0.1), which keeps every millimetre apart below ±10.48 km.
⚑ Origin.XY is fixed per tile. Origin.Z, the datum of the heights, is 0 today; a consumer must still add it, and must not assume it stays the same between two revisions of a chunk.
Tier 3 data, plain C++, no UObject: GC-invisible, passed by TSharedRef<const ...>. Built on a task-system worker from an FGroundQuery the game thread acquired; read on any thread afterwards.
Functions
- IsEmpty
- HeightAt
One post's height, cm above Origin.Z.
- CopyHeights
Copy every post's height, cm above Origin.Z: Posts² values, row-major (index = Row * Posts + Col, the Chaos layout).
- HasCellClass
Whether some cell has a ground class other than 0; false means every cell is class 0.
- CellClassAt
One cell's ground class: the value of Channels::GroundClass at the cell's (0,0) post.
- IsPainted
Whether some post holds paint: a layer other than 0, or more than one pair.
- PaintAt
One post's paint: its canonical pairs, heaviest first, absolute weights summing to 255 (slot 0's included), as a point query (FGroundQuery::Paint) answers.
- CopyPaint
Copy the paint as lists, Stride pairs per post, post-major: post K's pair S at K * Stride + S, posts row-major like the heights (FGroundQuery::CopyEditTilePaint's layout at Stride kPaintSlots).
- GetAllocatedSize
Bytes these posts own: the struct (which holds a tile's block bases, 4 bytes a block), the heights (2 bytes a post; a block of more than 65.535 m of relief adds 2 bytes a post, and then the block table 2 bytes a block), the ground classes and the paint planes made for them alone (FPaintPlaneRefs::OwnedMask).
- Readstatic
Read one edit-layer tile from a snapshot: heights (Modified surface) and ground class.
Properties
| Name | Type | Default | Meaning |
|---|---|---|---|
Tile | FInt | FInt | Edit-layer tile this chunk covers. |
Origin | FVector | FVector:: | World XY of post (0,0), cm; Z is the datum of the heights (0 today). |
Cell | double | 100.0 | Post spacing, cm. |
Posts | int32 | 0 | Posts per side; 0 = empty. |
Paint | int32 | 0 | Most (layer, weight) pairs any post of the chunk uses, 1..kPaintSlots; 0 when every post is unpainted (layer 0 alone). A consumer that draws fewer pairs reads the leading ones, the heaviest. |
Min | float | 0.f | Bounds of the heights, cm above Origin.Z. |
Max | float | 0.f | — |
Revision | uint64 | 0 | Snapshot revision the heights were read from. |
b | bool | false | At least one post answered from the mip pyramid, or the class or paint is Pending (a cold plane whose page has not landed: they read the defaults). Either way the ground journal reports the tile again when the exact data lands. |