FTerrainTileStreaming
The tile half of world partition, sharing StreamingManager's policy rather than inventing a second one: the same three radii (load < keepAlive < unload), the same "closer is sooner" priority, the same per-frame budget. A second streamer with its own radii would mean a tile popping in while the props standing on it are still unloaded, or the reverse.
- Module
- Game
- Header
#include "Terrain/TerrainTileStreaming.h"- Namespace
Mowo
Decide() is a pure function of (tiles, camera, settings, budget) so the whole policy is measurable headlessly — the residency it describes is applied by TerrainSystem, which is the only part that needs a device.
Public functions
| Returns | Name | Description |
|---|---|---|
float | DistanceToTile | Distance from the camera to the tile's nearest point, in meters, on the XZ plane. |
float | Priority | Higher loads sooner. |
FTerrainStreamingPlan | Decide | inFlightLoads is how many rebuilds the caller already has queued this frame; the plan's toLoad never exceeds settings.maxConcurrentLoads minus that, which is what keeps a camera teleport from rebuilding forty tiles in one frame. |
Function details
DistanceToTile
static float DistanceToTile(const FTerrainTileDesc& tile, const Vec3& cameraPos)Distance from the camera to the tile's nearest point, in meters, on the XZ plane. Tile EDGE, not centre: a 4 km tile whose centre is 2 km away can still be under the camera's feet, and centre distance would evict the ground it is standing on.
Priority
static float Priority(const FTerrainTileDesc& tile, const Vec3& cameraPos)Higher loads sooner. Negated distance, so the sort matches StreamingManager's exactly; an alwaysLoaded tile reports distance 0.
Decide
static FTerrainStreamingPlan Decide(const std::vector<FTerrainTileDesc>& tiles, const Vec3& cameraPos, const StreamingSettings& settings, uint32_t inFlightLoads)inFlightLoads is how many rebuilds the caller already has queued this frame; the plan's toLoad never exceeds settings.maxConcurrentLoads minus that, which is what keeps a camera teleport from rebuilding forty tiles in one frame.