载入中...
搜索中...
未找到
CrowdSurface.cpp
浏览该文件的文档.
21Result<Crowd::SurfacePlan> Crowd::prepareNavigationSurface(const NavigationSurfaceSnapshot& snapshot) const try {
26 if (snapshot.width <= 0 || snapshot.height <= 0 || count > 4 * 1024 * 1024 || !std::isfinite(snapshot.cellSize) ||
27 snapshot.cellSize <= 0.f || !std::isfinite(snapshot.originX) || !std::isfinite(snapshot.originY) ||
28 snapshot.stamp.surface.isZero() || snapshot.stamp.movement.isZero() || snapshot.stamp.surfaceRevision == 0 ||
33 return fail(DiagnosticCode::InvalidArgument, "Invalid surface geometry, identity, revision or array size");
35 const float physical = snapshot.terrainCosts[index], navigation = snapshot.navigationCosts[index];
36 const auto valid = [](float value) { return std::isfinite(value) && (value == 0.f || value >= 1.f); };
53 return fail(DiagnosticCode::Conflict, "Surface identity/revision has conflicting physical geometry");
79 plan.field_->resize(snapshot.width, snapshot.height, snapshot.cellSize, snapshot.originX, snapshot.originY);
87 return Result<SurfacePlan>::failure(Diagnostic::error(DiagnosticCode::Failed, error.what(), "navigationSurface"));
90 if (plan.owner_ != impl_->owner || plan.revision_ != impl_->field.revision() || (!plan.field_ && !plan.unchanged_))
101 return Result<void>::success(Status::success(unchanged ? StatusCode::NoOp : StatusCode::Applied));
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.cpp:19
Move-only prepared terrain/navigation publication.
Definition Crowd.h:271
SurfacePlan & operator=(SurfacePlan &&) noexcept
Transfer one-use publication ownership.
Definition CrowdSurface.cpp:12
Result< void > commitNavigationSurface(SurfacePlan &&plan)
Publish terrain and navigation projection together without allocation.
Definition CrowdSurface.cpp:89
Result< SurfacePlan > prepareNavigationSurface(const NavigationSurfaceSnapshot &snapshot) const
Validate and copy an immutable surface projection without publishing it.
Definition CrowdSurface.cpp:21
Definition Crowd.cpp:14
@ InvalidArgument
@ Failed
@ Conflict
@ NoOp
@ Applied