FNavGeometryCache
The geometry a runtime navmesh rebuild bakes from, refreshed on the game thread a few meshes per frame instead of copied whole when a rebuild starts. The game thread queues the entities whose mesh changed, Pump rebuilds their pieces within a vertex budget, and a bake thread reads Published() — a vector of immutable pieces — without ever touching the scene.
- Module
- AINavigation
- Header
#include "AINavigation/NavGeometryCache.h"- Namespace
Mowo
Type aliases
| Alias | Description |
|---|---|
using FBuildPiece = std::function<bool(EntityID, FNavGeometryPiece&)> |
Public functions
| Returns | Name | Description |
|---|---|---|
void | Request | Marks an entity's piece stale (new, moved or re-meshed). |
void | Remove | The entity left the scene or stopped being nav-relevant. |
size_t | Pump | Rebuilds queued pieces until vertexBudget vertices were produced; always at least one piece per call so a single large mesh cannot stall forever. |
size_t | PendingCount | Entities still waiting for their piece. |
std::vector<std::shared_ptr<const FNavGeometryPiece>> | Published | A copy of the published piece list. |
size_t | PieceCount | |
void | Clear | |
void | Assemble | Worker side: appends every piece whose ground-plane box reaches the region (all of them when regionMin is null) to out, moved into out.originOffset's frame; the region is in that frame too. |
Function details
Request
void Request(EntityID id)Marks an entity's piece stale (new, moved or re-meshed).
Remove
void Remove(const World& world, EntityID id)The entity left the scene or stopped being nav-relevant.
Pump
size_t Pump(const World& world, size_t vertexBudget, const FBuildPiece& build)Rebuilds queued pieces until vertexBudget vertices were produced; always at least one piece per call so a single large mesh cannot stall forever. build fills the piece (false = the entity has no nav geometry any more). Returns how many pieces were processed.
PendingCount
size_t PendingCount() constEntities still waiting for their piece. A rebuild must not start while this is non-empty, or it would bake a level with holes.
Published
std::vector<std::shared_ptr<const FNavGeometryPiece>> Published() constA copy of the published piece list. Safe to hand to another thread.
PieceCount
size_t PieceCount() constClear
void Clear()Assemble
static void Assemble(const std::vector<std::shared_ptr<const FNavGeometryPiece>>& pieces, const Vec3* regionMin, const Vec3* regionMax, NavMeshBuilder::Snapshot& out)Worker side: appends every piece whose ground-plane box reaches the region (all of them when regionMin is null) to out, moved into out.originOffset's frame; the region is in that frame too.