FFoliageCells
The per-cell store behind FoliageInstancesComponent::cells. Instances live in 64 m world cells, one codec string per occupied cell.
- Module
- Game
- Header
#include "Terrain/FoliageInstances.h"- Namespace
Mowo
Properties
| Type | Name | Description |
|---|---|---|
static constexpr float | kCellSize | Default 64.0f. |
Public functions
| Returns | Name | Description |
|---|---|---|
void | CellOf | |
uint64_t | Key | |
uint64_t | HashInstances | Order-sensitive hash of a cell's instances; what the brush compares to decide whether a cell needs re-encoding. |
bool | Migrate | Moves a legacy whole-level blob (instances) into cells and empties the blob. |
bool | DecodeAll | The legacy blob plus every cell, in a stable order. |
bool | DecodeAllHashed | The same, and records each cell's content hash so the next Store can skip the cells the brush did not touch. |
bool | DecodeCell | |
uint32_t | Store | Replaces the component's content with all: partitions it into cells, re-encodes only the cells whose hash changed, drops emptied cells and clears the legacy blob. |
Function details
CellOf
static void CellOf(const Vec3& position, int32_t& outX, int32_t& outZ)Key
static uint64_t Key(int32_t x, int32_t z)HashInstances
static uint64_t HashInstances(const std::vector<FFoliagePaintedInstance>& instances)Order-sensitive hash of a cell's instances; what the brush compares to decide whether a cell needs re-encoding.
Migrate
static bool Migrate(FoliageInstancesComponent& component)Moves a legacy whole-level blob (instances) into cells and empties the blob. False when there was nothing to migrate or the blob is unreadable (then it is left untouched, so a newer build's data is never lost).
DecodeAll
static bool DecodeAll(const FoliageInstancesComponent& component, std::vector<FFoliagePaintedInstance>& out)The legacy blob plus every cell, in a stable order. False when any part is unreadable.
DecodeAllHashed
static bool DecodeAllHashed(FoliageInstancesComponent& component, std::vector<FFoliagePaintedInstance>& out)The same, and records each cell's content hash so the next Store can skip the cells the brush did not touch.
DecodeCell
static bool DecodeCell(const FFoliageCell& cell, std::vector<FFoliagePaintedInstance>& out)Store
static uint32_t Store(FoliageInstancesComponent& component, const std::vector<FFoliagePaintedInstance>& all)Replaces the component's content with all: partitions it into cells, re-encodes only the cells whose hash changed, drops emptied cells and clears the legacy blob. Returns how many cells were re-encoded.