载入中...
搜索中...
未找到
ClimbingAnchorGraph.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
11#include "common/Result.h"
13#include "common/StrongUint64.h"
14#include "common/Value.h"
16
17#include <cstddef>
18#include <cstdint>
19#include <string>
20#include <string_view>
21#include <unordered_map>
22#include <vector>
23
24namespace eve::physics {
25class World3D;
26}
27
28namespace eve::climbing {
29
32
34enum class ClimbingAnchorEdgeKind : std::uint8_t {
35 Shimmy,
36 Corner,
37 Jump,
38 Drop,
39 Mount,
41 Climb,
42 Balance,
43 Swing
44};
45
61
72
76 static constexpr std::string_view SchemaId = "evengine.climbing-anchor-graph";
78 static constexpr std::int64_t SchemaVersion = 2;
79
80 std::string id;
82 std::string buildSettingsHash;
83 std::vector<ClimbingAnchorNodeDefinition> nodes;
84 std::vector<ClimbingAnchorEdgeDefinition> edges;
87};
88
96 const eve::Value& value);
97
98namespace detail {
103}
104
109
119
122 std::string graphId;
123 std::string nodeId;
124 std::uint64_t graphGeneration = 0;
125};
126
136
138enum class ClimbingRouteOccupancyPolicy : std::uint8_t { Ignore, AvoidFull };
139
154
161
164 std::string graphId;
165 std::uint64_t graphGeneration = 0;
166 std::vector<ClimbingAnchorNodeRef> nodes;
167 std::vector<ClimbingAnchorRouteStep> steps;
168};
169
184
187 std::uint64_t oldGeneration = 0;
188 std::uint64_t newGeneration = 0;
189 std::vector<ClimbingAnchorOccupant> invalidatedOccupants;
190};
191
199public:
210 [[nodiscard]] eve::Result<ClimbingAnchorNodeRef> nodeRef(std::string_view nodeId) const;
213 const ClimbingAnchorNodeRef& reference) const;
218 [[nodiscard]] eve::Result<ResolvedClimbingAnchorNode> resolveNodeKinematics(
222 const ClimbingAnchorNodeRef& reference) const;
228 [[nodiscard]] eve::Result<ClimbingAnchorRoute> planRoute(const ClimbingAnchorRouteRequest& request) const;
231 ClimbingAnchorOccupant occupant);
233 [[nodiscard]] eve::Result<void> validateReservation(const ClimbingAnchorReservation& reservation) const;
238 [[nodiscard]] eve::Result<ClimbingAnchorReservation> transferReservation(
239 const ClimbingAnchorReservation& reservation);
247 [[nodiscard]] eve::Result<ClimbingAnchorReservation> restoreReservation(
248 const ClimbingAnchorReservation& reservation);
250 [[nodiscard]] eve::Result<void> release(const ClimbingAnchorReservation& reservation);
252 [[nodiscard]] eve::Result<std::uint32_t> releaseOccupant(ClimbingAnchorOccupant occupant);
259 [[nodiscard]] std::uint64_t generation() const noexcept { return generation_; }
261 [[nodiscard]] physics::PhysicsBodyHandle body() const noexcept { return body_; }
263 [[nodiscard]] std::size_t reservationCount() const noexcept { return reservations_.size(); }
264
265private:
266 struct ReservationRecord {
267 std::string nodeId;
268 std::uint32_t slot = 0;
269 ClimbingAnchorOccupant occupant;
270 std::uint64_t claimGeneration = 1;
271 };
272
278 const ClimbingAnchorNodeDefinition* findNode(std::string_view nodeId) const noexcept;
279
280 ClimbingAnchorGraphDefinition graph_;
281 physics::PhysicsWorldHandle world_ = physics::PhysicsWorldHandle::invalid();
282 physics::PhysicsBodyHandle body_ = physics::PhysicsBodyHandle::invalid();
283 std::uint64_t generation_ = 1;
284 ClimbingAnchorReservationId nextReservationId_{1};
285 std::unordered_map<ClimbingAnchorReservationId, ReservationRecord> reservations_;
286};
287
292
293} // namespace eve::climbing
double value
AuthorityStoreHandleRef reference
Definition Authority.cpp:24
Shared value types with no climbing runtime dependency.
std::string nodeId
#define EVENGINE_API_DOMAINS
Definition Export.h:110
const GltfImportRequest & request
std::map< std::string, std::vector< std::string > > graph
Definition Package.cpp:59
World3D * world
Process-local, generation-qualified handles owned by the physics domain.
std::function< eve::Result< void >()> release
Definition Procgen.cpp:86
int detail
Move-only, checked operation results for the common layer.
Explicit Value/Owned/Borrowed semantics at the Squirrel boundary.
Internal storage primitive for domain-owned unsigned values.
std::string body
Owning, renderer-independent dynamic values.
Move-only operation result carrying either a value or Status.
Definition Result.h:155
static constexpr RuntimeHandle invalid() noexcept
Returns the canonical invalid handle.
The canonical owning dynamic value used by data-facing protocols.
Definition Value.h:31
std::map< std::string, Value > Object
Definition Value.h:34
Runtime instance binding one immutable graph generation to one Physics body.
std::uint64_t generation() const noexcept
Current monotonically increasing topology generation.
physics::PhysicsBodyHandle body() const noexcept
Target Physics body handle; stale detection occurs during resolve.
std::size_t reservationCount() const noexcept
Number of live reservations in this graph instance.
static constexpr StrongUint64 zero() noexcept
Returns the zero value for this strong type.
Box3D rigid-body world. Script coordinates are meters (Box3D native), unlike 2D World which uses pixe...
Definition World3D.h:63
ClimbingAnchorEdgeKind
Allowed authored transition between two explicit anchors.
eve::Result< ClimbingAnchorGraphDefinition > decodeClimbingAnchorGraphDefinition(const eve::Value &value)
Decodes and validates a complete owning graph candidate transactionally.
ClimbingAnchorKind
Authored semantic of one explicit climbing anchor.
ClimbingRouteOccupancyPolicy
Policy controlling whether deterministic route planning may cross fully occupied nodes.
eve::Result< void > validateClimbingAnchorGraphDefinition(const ClimbingAnchorGraphDefinition &graph)
Validates all graph identities, frames, slots, tags, and edge endpoints.
eve::Result< eve::Value > encodeClimbingAnchorGraphDefinition(const ClimbingAnchorGraphDefinition &graph)
Encodes a validated graph to its canonical owning Value representation.
Optional physics backend for vehicle mobility and body attach.
Definition Climbing.h:36
Directed authored transition in a climbing anchor graph.
eve::Value::Object extensionMetadata
Unknown schema fields retained across decode and encode.
Versioned graph asset; topology is authoritative while collision remains owned by Physics.
eve::Value::Object extensionMetadata
Unknown schema fields retained across decode and encode.
std::vector< ClimbingAnchorNodeDefinition > nodes
std::vector< ClimbingAnchorEdgeDefinition > edges
static constexpr std::string_view SchemaId
Canonical schema id.
Handle domain for module-owned anchor graph runtime instances.
Atomic graph-reload outcome and owners whose old-generation reservations were invalidated.
std::vector< ClimbingAnchorOccupant > invalidatedOccupants
One body-local anchor node with deterministic occupancy slots.
eve::Value::Object extensionMetadata
Unknown schema fields retained across decode and encode.
Generation-qualified reference to an authored anchor node.
Compound occupancy owner; execution ids are only unique inside one agent/runtime.
friend auto operator<=>(const ClimbingAnchorOccupant &, const ClimbingAnchorOccupant &) noexcept=default
Operator <=>.
friend bool operator==(const ClimbingAnchorOccupant &, const ClimbingAnchorOccupant &) noexcept=default
Operator ==.
Owning reservation credential; release validates every field.
Read-only route request over one current anchor-graph generation.
std::vector< ClimbingAnchorEdgeKind > allowedEdgeKinds
Empty means every authored edge kind is allowed.
std::uint32_t maxVisitedNodes
Deterministic safety bound; planning fails instead of returning a partial route.
std::vector< std::string > availableTags
Stable capability tags available to the route consumer; every edge requirement must be present.
ClimbingAnchorOccupant requester
Existing owner allowed to traverse its own current reservation; both ids must be zero or non-zero.
One owning directed edge in a planned anchor route.
Shortest deterministic route pinned to one graph generation.
std::vector< ClimbingAnchorNodeRef > nodes
std::vector< ClimbingAnchorRouteStep > steps
World-space projection of a body-local anchor at one synchronous resolve point.
Small owning world-space vector used at climbing module boundaries.
ClimbingAnchorReservationIdTag public API.