载入中...
搜索中...
未找到
VegetationSceneLiveElements.cpp
浏览该文件的文档.
26 "extras-overlay", "extras-wetness", "motion-advanced", "motion-interaction", "motion-wind-power",
27 "vertex-conform-model", "vertex-conform-simple", "vertex-conform-terrain", "vertex-height-offset",
33 const float rotationLength = std::sqrt(std::inner_product(element.rotation.begin(), element.rotation.end(),
40 !validGuid(element.textureGuid, true) || !kinds.contains(element.kind) || element.channel != expectedChannel ||
43 element.layers == 0 || (element.layers & ~0x1ffu) || !finite(element.intensity) || element.intensity < 0.f ||
45 element.motionPower > 1.f || !finiteValues(element.position) || !finiteValues(element.rotation) ||
50 std::any_of(element.scale.begin(), element.scale.end(), [](float value) { return value <= 0.f; }) ||
60 if (property.name.empty() || property.name.size() > 128 || property.type < 0 || property.type > 2 ||
75 DiagnosticCode::InvalidArgument, "vegetation live-element registry identity or scene is invalid", {}, {},
81 Diagnostic::error(DiagnosticCode::InvalidArgument, "vegetation live-element base scene is invalid", {}, {},
85 std::unique_ptr<VegetationSceneLiveElements>(new VegetationSceneLiveElements(std::move(baseScene), owner)));
88 Diagnostic::error(DiagnosticCode::Failed, "vegetation live-element registry allocation failed", {}, {},
102 Diagnostic::error(DiagnosticCode::Failed, "vegetation live-element snapshot allocation failed", {}, {},
108 std::uint64_t expectedRevision, std::uint64_t expectedGpuRevision, const VegetationSceneElement& element,
110 const graphics::VegetationMotion& baseMotion, const std::map<std::string, graphics::VegetationMask>& masks,
114 Diagnostic::error(DiagnosticCode::Conflict, "vegetation live-element state changed before registration", {},
118 Diagnostic::error(DiagnosticCode::InvalidArgument, "vegetation live Element is invalid", {}, {},
121 while (slotIndex < slots_.size() && (slots_[slotIndex].element || slots_[slotIndex].retired)) ++slotIndex;
127 Diagnostic::error(DiagnosticCode::InvalidArgument, "vegetation live-element capacity exceeded", {}, {},
136 Diagnostic::error(DiagnosticCode::Failed, "vegetation live-element registration allocation failed", {}, {},
139 auto published = runtime.replace(expectedGpuRevision, baseSurface, baseMotion, candidate.value(), masks, build);
146 {{owner_, static_cast<VegetationSceneElementHandle::index_type>(slotIndex), slot.generation}, revision_,
151 std::uint64_t expectedRevision, std::uint64_t expectedGpuRevision, VegetationSceneElementHandle handle,
153 const graphics::VegetationMotion& baseMotion, const std::map<std::string, graphics::VegetationMask>& masks,
157 Diagnostic::error(DiagnosticCode::Conflict, "vegetation live-element state changed before withdrawal", {},
161 Diagnostic::error(DiagnosticCode::NotFound, "vegetation live Element handle is foreign or missing", {}, {},
166 Diagnostic::error(DiagnosticCode::NotFound, "vegetation live Element handle is stale or withdrawn", {}, {},
170 Diagnostic::error(DiagnosticCode::InvalidArgument, "vegetation live-element revision is exhausted", {}, {},
178 candidate.value().elements.erase(candidate.value().elements.begin() + dynamicOffset + activeBefore);
179 auto published = runtime.replace(expectedGpuRevision, baseSurface, baseMotion, candidate.value(), masks, build);
188 return Result<VegetationSceneElementPublication>::success({handle, revision_, published.value()});
Transactional runtime registration of TVE Element volumes.
static Result< AssetRef > parse(std::string_view text)
Parse an asset://<canonical UUID> reference.
Definition ResourceRef.cpp:20
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
constexpr std::optional< RuntimeHandle > nextGeneration() const noexcept
Returns this slot at its next generation.
Definition RuntimeHandle.h:170
Instance-qualified handle for one dynamically registered TVE Element volume.
Definition VegetationSceneLiveElements.h:18
LocalHandle::index_type index_type
Definition VegetationSceneLiveElements.h:21
Owning GPU publication of one immutable TVE manager scene. The resource factory, mask map and scene a...
Definition EvpackVegetationScene.h:250
Owning registry that atomically couples dynamic Element state to a scene GPU runtime....
Definition VegetationSceneLiveElements.h:60
Result< LoadedVegetationScene > snapshot() const
Detached scene containing imported Elements followed by live slots in stable index order.
Definition VegetationSceneLiveElements.cpp:93
static Result< std::unique_ptr< VegetationSceneLiveElements > > create(LoadedVegetationScene baseScene, std::uint64_t owner)
Create a registry from one validated imported scene.
Definition VegetationSceneLiveElements.cpp:71
Result< VegetationSceneElementPublication > registerElement(std::uint64_t expectedRevision, std::uint64_t expectedGpuRevision, const VegetationSceneElement &element, VegetationSceneGpuRuntime &runtime, const graphics::PbrSurface &baseSurface, const graphics::VegetationMotion &baseMotion, const std::map< std::string, graphics::VegetationMask > &masks, const VegetationSceneGpuBuild &build)
Register and publish one Element as an atomic registry/GPU transaction.
Definition VegetationSceneLiveElements.cpp:107
Result< VegetationSceneElementPublication > withdrawElement(std::uint64_t expectedRevision, std::uint64_t expectedGpuRevision, VegetationSceneElementHandle handle, VegetationSceneGpuRuntime &runtime, const graphics::PbrSurface &baseSurface, const graphics::VegetationMotion &baseMotion, const std::map< std::string, graphics::VegetationMask > &masks, const VegetationSceneGpuBuild &build)
Withdraw and publish one live Element as an atomic registry/GPU transaction. Foreign,...
Definition VegetationSceneLiveElements.cpp:150
Definition CookedMaterial.cpp:5
@ InvalidArgument
@ NotFound
@ Failed
@ Conflict
Fully validated, detached scene-manager candidate with no archive or GPU borrows.
Definition EvpackVegetationScene.h:103
std::vector< VegetationSceneElement > elements
Definition EvpackVegetationScene.h:111
One normalized Unity TVEElement definition awaiting texture realization.
Definition EvpackVegetationScene.h:60
Explicit detached inputs for publishing all nine TVE scene-manager field layers.
Definition EvpackVegetationScene.h:233
Owning material parameter snapshot; texture pointers remain borrowed. Base color/metallic/roughness c...
Definition PbrSurface.h:218
Source-equivalent plant motion parameters with explicit time and texture inputs. All data is owned....
Definition VegetationMotion.h:38