载入中...
搜索中...
未找到
ProcgenSceneSink.h
浏览该文件的文档.
1#pragma once
2
3#include <optional>
4#include "common/Export.h"
7#include "common/Result.h"
8
9#include <cstdint>
10#include <functional>
11#include <string>
12#include <vector>
13
14namespace eve {
22
26 uint64_t sourcePointId = 0;
27 std::string id;
30 std::string asset;
31 float x = 0.f;
32 float y = 0.f;
33 float z = 0.f;
35 float yaw = 0.f;
36 float scaleX = 1.f;
37 float scaleY = 1.f;
38 float scaleZ = 1.f;
39 uint32_t seed = 1;
41 float pitch = 0.f;
43 float roll = 0.f;
45 std::optional<ProcgenInstanceAssetBinding> assetBinding{};
46};
47
50 uint64_t baseRevision = 0;
51 uint64_t targetRevision = 0;
52 std::vector<ProcgenInstanceDesc> added;
53 std::vector<ProcgenInstanceDesc> updated;
55 std::vector<uint64_t> removedPointIds;
57 std::vector<std::string> removed;
59 std::vector<uint64_t> targetPointOrder;
61 std::vector<std::string> targetOrder;
62};
63
73 const std::vector<ProcgenInstanceDesc>& current, uint64_t currentRevision, const ProcgenInstanceDelta& delta);
74
78 std::string batchId;
80 uint64_t targetRevision = 0;
82 std::vector<ProcgenInstanceDesc> instances;
83};
84
93public:
94 static constexpr const char* capabilityName = "IProcgenSceneSink";
95
97 virtual ~IProcgenSceneSink() = default;
99 virtual bool applyBatch(const std::string& batchId,
100 const std::vector<ProcgenInstanceDesc>& instances) = 0;
110 [[nodiscard]] virtual Result<uint64_t> replaceBatch(
111 const std::string& batchId, uint64_t targetRevision,
112 const std::vector<ProcgenInstanceDesc>& instances) = 0;
120 [[nodiscard]] virtual Result<uint64_t> replaceBatches(const std::vector<ProcgenBatchSnapshot>& snapshots) = 0;
122 virtual bool removeBatch(const std::string& batchId) = 0;
130 [[nodiscard]] virtual Result<uint64_t> removeBatches(const std::vector<std::string>& batchIds) = 0;
141 const std::vector<std::string>& batchIds, const std::function<Result<void>()>& commitPreparedOwner) = 0;
148 [[nodiscard]] virtual Result<uint64_t> applyDelta(const std::string& batchId,
149 const ProcgenInstanceDelta& delta) = 0;
151 virtual uint64_t batchRevision(const std::string& batchId) const = 0;
153 virtual int instanceCount(const std::string& batchId) const = 0;
155 virtual int lastCreatedCount(const std::string& batchId) const = 0;
157 virtual int lastReusedCount(const std::string& batchId) const = 0;
159 virtual int lastRemovedCount(const std::string& batchId) const = 0;
173 const std::vector<ProcgenBatchSnapshot>& snapshots, const std::function<Result<void>()>& commitPreparedOwner) {
174 (void)snapshots;
175 (void)commitPreparedOwner;
176 return Result<uint64_t>::failure(Diagnostic::error(
177 DiagnosticCode::Unsupported, "scene provider does not support coordinated batch replacement"));
178 }
179};
180
181} // namespace eve
double z
double y
double x
float yaw
Definition BushMesh.cpp:37
#define EVENGINE_API_FOUNDATION_INLINE
仅供"只有内联成员"的类型使用的组宏:拥有者 dllexport,消费方不导入。
Definition Export.h:170
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
Definition Export.h:106
Strong asset, definition, object and generic resource references.
Move-only, checked operation results for the common layer.
double current
uint32_t seed
Definition TreeMesh.cpp:276
Stable asset identity backed by PersistentId.
Definition ResourceRef.h:53
Optional scene consumer for procedural instance batches.
virtual Result< uint64_t > applyDelta(const std::string &batchId, const ProcgenInstanceDelta &delta)=0
Apply one prevalidated identity delta atomically to an existing batch.
virtual Result< uint64_t > replaceBatchesCoordinated(const std::vector< ProcgenBatchSnapshot > &snapshots, const std::function< Result< void >()> &commitPreparedOwner)
Replace complete batches while committing one prepared external resource owner.
virtual int lastRemovedCount(const std::string &batchId) const =0
Instances removed by the batch's latest successful apply or removal.
virtual Result< uint64_t > removeBatches(const std::vector< std::string > &batchIds)=0
Atomically remove several published batches.
virtual int lastReusedCount(const std::string &batchId) const =0
Stable-id instances reused by the batch's latest successful apply.
virtual ~IProcgenSceneSink()=default
I procgen scene sink.
virtual uint64_t batchRevision(const std::string &batchId) const =0
Current committed revision of a batch, or zero when it is absent.
virtual bool applyBatch(const std::string &batchId, const std::vector< ProcgenInstanceDesc > &instances)=0
Create or reconcile all instances in a named batch.
virtual int instanceCount(const std::string &batchId) const =0
Number of currently published instances in a batch.
virtual int lastCreatedCount(const std::string &batchId) const =0
Instances newly created by the batch's latest successful apply.
virtual Result< uint64_t > replaceBatch(const std::string &batchId, uint64_t targetRevision, const std::vector< ProcgenInstanceDesc > &instances)=0
Atomically replace a batch with a complete stable-identity snapshot at an explicit revision.
virtual Result< uint64_t > removeBatchesCoordinated(const std::vector< std::string > &batchIds, const std::function< Result< void >()> &commitPreparedOwner)=0
Remove several batches while coordinating one external authoritative commit.
virtual bool removeBatch(const std::string &batchId)=0
Remove the visible contents of a batch.
virtual Result< uint64_t > replaceBatches(const std::vector< ProcgenBatchSnapshot > &snapshots)=0
Atomically replace several batches from complete snapshots.
Move-only operation result carrying either a value or Status.
Definition Result.h:176
Id128 public API.
Definition Identity.h:111
Build metadata (engine git commit, build time, third-party version).
Definition Build.cpp:16
Result< std::vector< ProcgenInstanceDesc > > buildProcgenInstanceDeltaSnapshot(const std::vector< ProcgenInstanceDesc > &current, uint64_t currentRevision, const ProcgenInstanceDelta &delta)
Build an owning target snapshot from one exact revision and identity delta; does not publish state.
PrefabRootPose
Immutable prefab placement convention shared by geometry bounds and renderer preparation....
One complete cell snapshot participating in an atomic multi-batch publication.
std::string batchId
Stable target batch identity.
std::vector< ProcgenInstanceDesc > instances
Complete ordered target contents.
Stable procedural prefab link at an exact admitted package build; contains no runtime pointers.
PrefabRootPose rootPose
Missing historical PointSet attributes retain authored pose.
Identity-based, revision-checked mutation of one procedural scene batch.
std::vector< uint64_t > removedPointIds
Stable source PointIds removed from the target batch.
std::vector< std::string > targetOrder
Compatibility target order addressed directly by Scene instance id.
std::vector< ProcgenInstanceDesc > updated
std::vector< std::string > removed
Compatibility removals addressed directly by Scene instance id.
std::vector< uint64_t > targetPointOrder
Exact target order addressed by stable source PointId.
std::vector< ProcgenInstanceDesc > added
Engine-neutral description of one procedural scene instance.
std::string asset
Compatibility asset label; when assetBinding exists, its typed identity is authoritative and must mat...