载入中...
搜索中...
未找到
VegetationSceneLiveElements.h
浏览该文件的文档.
1#pragma once
2
7
8#include <cstdint>
9#include <memory>
10#include <optional>
11#include <vector>
12
13namespace eve::asset_graphics {
14
15struct VegetationSceneElementHandleTag;
16
19public:
23
25 constexpr VegetationSceneElementHandle() noexcept = default;
30 : owner_(owner), local_(index, generation) {}
32 [[nodiscard]] constexpr bool isValid() const noexcept { return owner_ != 0 && local_.isValid(); }
34 [[nodiscard]] constexpr std::uint64_t owner() const noexcept { return owner_; }
36 [[nodiscard]] constexpr index_type index() const noexcept { return local_.index(); }
38 [[nodiscard]] constexpr generation_type generation() const noexcept { return local_.generation(); }
40 friend constexpr bool operator==(const VegetationSceneElementHandle&,
41 const VegetationSceneElementHandle&) noexcept = default;
42
43private:
44 std::uint64_t owner_ = 0;
45 LocalHandle local_{};
46};
47
54
61public:
68 [[nodiscard]] static Result<std::unique_ptr<VegetationSceneLiveElements>> create(
69 LoadedVegetationScene baseScene, std::uint64_t owner);
70
72 [[nodiscard]] std::uint64_t revision() const noexcept { return revision_; }
74 [[nodiscard]] Result<LoadedVegetationScene> snapshot() const;
75
84 [[nodiscard]] Result<VegetationSceneElementPublication> registerElement(
85 std::uint64_t expectedRevision, std::uint64_t expectedGpuRevision, const VegetationSceneElement& element,
86 VegetationSceneGpuRuntime& runtime, const graphics::PbrSurface& baseSurface,
87 const graphics::VegetationMotion& baseMotion,
88 const std::map<std::string, graphics::VegetationMask>& masks, const VegetationSceneGpuBuild& build);
89
95 [[nodiscard]] Result<VegetationSceneElementPublication> withdrawElement(
96 std::uint64_t expectedRevision, std::uint64_t expectedGpuRevision, VegetationSceneElementHandle handle,
97 VegetationSceneGpuRuntime& runtime, const graphics::PbrSurface& baseSurface,
98 const graphics::VegetationMotion& baseMotion,
99 const std::map<std::string, graphics::VegetationMask>& masks, const VegetationSceneGpuBuild& build);
100
101private:
102 struct Slot {
103 std::optional<VegetationSceneElement> element;
105 bool retired = false;
106 };
107
108 VegetationSceneLiveElements(LoadedVegetationScene baseScene, std::uint64_t owner) noexcept
109 : baseScene_(std::move(baseScene)), owner_(owner) {}
110
111 LoadedVegetationScene baseScene_;
112 std::vector<Slot> slots_;
113 std::uint64_t owner_ = 0;
114 std::uint64_t revision_ = 1;
115};
116
117} // namespace eve::asset_graphics
Runtime decoding and projection of TVE scene-manager state.
#define EVENGINE_API_WORLD
Definition Export.h:109
bool retired
std::uint32_t generation
PrimitiveHandle handle
Strong generation-qualified handles for non-ECS runtime registries.
std::string element
Move-only operation result carrying either a value or Status.
Definition Result.h:155
constexpr generation_type generation() const noexcept
Returns the owner-local replacement generation.
constexpr bool isValid() const noexcept
Returns whether both coordinates are usable handle values.
constexpr index_type index() const noexcept
Returns the owner-local slot index.
detail::HandleCoordinates::generation_type generation_type
Unsigned owner-local generation type.
detail::HandleCoordinates::index_type index_type
Unsigned owner-local slot index type.
Instance-qualified handle for one dynamically registered TVE Element volume.
constexpr std::uint64_t owner() const noexcept
Owner.
friend constexpr bool operator==(const VegetationSceneElementHandle &, const VegetationSceneElementHandle &) noexcept=default
Operator ==.
constexpr bool isValid() const noexcept
True when valid.
constexpr VegetationSceneElementHandle() noexcept=default
Constructs a VegetationSceneElementHandle.
constexpr index_type index() const noexcept
Index.
constexpr generation_type generation() const noexcept
Generation.
Owning GPU publication of one immutable TVE manager scene. The resource factory, mask map and scene a...
Owning registry that atomically couples dynamic Element state to a scene GPU runtime....
std::uint64_t revision() const noexcept
Current successful mutation revision; begins at one.
Fully validated, detached scene-manager candidate with no archive or GPU borrows.
Receipt for one published dynamic Element registration or withdrawal.
One normalized Unity TVEElement definition awaiting texture realization.
Explicit detached inputs for publishing all nine TVE scene-manager field layers.
Receipt for one atomic scene-manager GPU replacement.
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....