载入中...
搜索中...
未找到
CrowdTypes.h
浏览该文件的文档.
1#pragma once
2
3#include <memory>
4#include <vector>
7
8#include <cstdint>
9
10namespace eve::crowd {
12struct FlowGoal {
13 int x = 0, y = 0;
15 friend auto operator<=>(const FlowGoal&, const FlowGoal&) = default;
16};
29 std::uint64_t revision = 0;
30 friend bool operator==(const MovementBinding&, const MovementBinding&) = default;
31};
41inline constexpr std::uint32_t flowBuildAlgorithmVersion = 1;
42class Crowd;
43class CrowdField;
48class FlowLease {
49 friend class Crowd;
50 std::shared_ptr<const CrowdField> field_;
51 std::shared_ptr<const void> pin_;
52 std::uint64_t owner_ = 0, input_ = 0, generation_ = 0;
53 std::uint32_t algorithm_ = flowBuildAlgorithmVersion;
54
55public:
57 FlowLease() = default;
59 [[nodiscard]] std::uint64_t generation() const noexcept { return generation_; }
60};
63 std::size_t entries = 0;
64 std::uint64_t residentBytes = 0, budgetBytes = 0;
65};
72 int width = 0, height = 0;
73 float cellSize = 0.f, originX = 0.f, originY = 0.f;
74 std::vector<float> terrainCosts, navigationCosts;
75 bool diagonal = true;
76 bool destinationEntryCost = false;
77};
78
80struct CrowdAgentTag {};
83
90struct AgentRef {
92 std::uint64_t owner = 0;
93
95 [[nodiscard]] bool isValid() const noexcept { return owner != 0 && handle.isValid(); }
97 friend bool operator==(const AgentRef&, const AgentRef&) noexcept = default;
98};
99
100} // namespace eve::crowd
Strong generation-qualified handles for non-ECS runtime registries.
Internal storage primitive for domain-owned unsigned values.
constexpr bool isValid() const noexcept
Returns whether both coordinates are usable handle values.
连续流场(flow field)。
Definition CrowdField.h:25
群体行为模块:连续流场寻路 + 海量单位移动/转向/行动 + Boids 鸟群。
Definition Crowd.h:266
Owning immutable field lease; copies pin storage, never the Crowd provider. @thread Copy/release/quer...
Definition CrowdTypes.h:48
FlowLease()=default
Construct an unbound lease, selecting compatibility default-field steering.
std::uint64_t generation() const noexcept
Observe the non-reused owner-local generation; zero means unbound.
Definition CrowdTypes.h:59
constexpr std::uint32_t flowBuildAlgorithmVersion
Increment when the navigation construction algorithm changes its observable output.
Definition CrowdTypes.h:41
Agent identity qualified by the Crowd instance that owns its registry. @ownership Value only; it neit...
Definition CrowdTypes.h:90
bool isValid() const noexcept
Whether the value contains an owner and usable coordinates; does not prove liveness.
Definition CrowdTypes.h:95
AgentHandle handle
Definition CrowdTypes.h:91
friend bool operator==(const AgentRef &, const AgentRef &) noexcept=default
Compare exact owner, slot and generation identity.
std::uint64_t owner
Definition CrowdTypes.h:92
Owner-local registry identity for a Crowd agent, independent of dense storage.
Definition CrowdTypes.h:80
Retained navigation-storage accounting; excludes allocator bookkeeping and pending builds.
Definition CrowdTypes.h:62
Logical grid destination; canonical request sets sort lexicographically and remove duplicates.
Definition CrowdTypes.h:12
friend auto operator<=>(const FlowGoal &, const FlowGoal &)=default
Compare exact cell coordinates, independently of source order.
Agent-owned selection of a provider-defined movement policy. Zero identity and revision mean compatib...
Definition CrowdTypes.h:27
friend bool operator==(const MovementBinding &, const MovementBinding &)=default
MovementClassId movement
Definition CrowdTypes.h:28
Movement policy identity; the provider owns its stable definition.
Definition CrowdTypes.h:20
Owning adapter input: raw physical terrain and separately inflated navigation costs....
Definition CrowdTypes.h:70
std::vector< float > terrainCosts
Definition CrowdTypes.h:74
std::vector< float > navigationCosts
Definition CrowdTypes.h:74
bool diagonal
Eight-neighbor navigation when true, four-neighbor otherwise.
Definition CrowdTypes.h:75
bool destinationEntryCost
Forward movement charges destination costs when true.
Definition CrowdTypes.h:76
Provenance of one immutable navigation projection.
Definition CrowdTypes.h:33
friend bool operator==(const NavigationSurfaceStamp &, const NavigationSurfaceStamp &)=default
Domain tags for world-owned navigation identities.
Definition CrowdTypes.h:18