载入中...
搜索中...
未找到
AttackVfxRecipe.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
17#include "common/Identity.h"
18#include "common/Result.h"
19
20#include <cstdint>
21#include <map>
22#include <optional>
23#include <string>
24#include <string_view>
25#include <vector>
26
27namespace eve::stylize {
28
30enum class AttackVfxPhaseKind : std::uint8_t {
32 Release,
33 Travel,
34 Impact,
35 Aftermath,
36 Status
37};
38
40enum class AttackVfxLayerRole : std::uint8_t {
42 MeshVfx,
43 Trail,
44 Particles,
45 Decal,
47 Camera,
48 Prefab,
49 Audio
50};
51
53enum class AttackVfxStopBehavior : std::uint8_t {
56};
57
64
66enum class AttackVfxSpatialAnchor : std::uint8_t { Source, Target };
67
70 float x = 0.f;
71 float y = 0.f;
72 float z = 0.f;
73
75 auto operator<=>(const AttackVfxVec3&) const = default;
76};
77
85 AttackVfxSpatialAttachment attachment = AttackVfxSpatialAttachment::FollowTarget;
86 AttackVfxSpatialAnchor anchor = AttackVfxSpatialAnchor::Source;
87 std::size_t targetIndex = 0;
88 std::string bone;
91 AttackVfxVec3 scale{1.f, 1.f, 1.f};
92
94 auto operator<=>(const AttackVfxSpatial&) const = default;
95
97 [[nodiscard]] Result<void> validate(std::string_view path) const;
98};
99
107 AttackVfxLayerRole role = AttackVfxLayerRole::Particles;
108 std::string uri;
110 std::map<std::string, float> floatParams;
111 AttackVfxStopBehavior stopBehavior = AttackVfxStopBehavior::StopEmitting;
112
114 [[nodiscard]] Result<void> validate(std::string_view path) const;
115};
116
125 AttackVfxPhaseKind kind = AttackVfxPhaseKind::Release;
126 std::string startCue;
127 std::string endCue;
128 double startOffsetSeconds = 0.0;
129 double durationSeconds = 0.0;
130 std::vector<AttackVfxLayer> layers;
131
133 [[nodiscard]] Result<void> validate(std::string_view path) const;
134};
135
138 AttackVfxVec3 primary{1.f, 1.f, 1.f};
139 AttackVfxVec3 secondary{1.f, 1.f, 1.f};
140 AttackVfxVec3 emissive{1.f, 1.f, 1.f};
141
143 auto operator<=>(const AttackVfxPalette&) const = default;
144};
145
155 std::map<std::string, std::string> styleHints;
156 std::map<std::string, float> shakeProfile;
157 std::map<std::string, float> distortionProfile;
158 std::string statusOverlayUri;
159
161 [[nodiscard]] Result<void> validate() const;
162
167 [[nodiscard]] static Result<AttackVfxSkin> fromJson(std::string_view json);
168
170 [[nodiscard]] Result<std::string> toJson() const;
171};
172
175 int lod = 0;
176 int maxParticles = 0;
177 bool allowDistortion = true;
178
180 auto operator<=>(const AttackVfxBudget&) const = default;
181};
182
190 static constexpr std::string_view schemaId = "eve.stylize.attack-vfx";
191 static constexpr std::uint32_t schemaVersion = 1;
192
194 std::vector<AttackVfxPhase> phases;
195 std::optional<LogicalId> skinId;
196 std::optional<AttackVfxSkin> skin;
198
203 [[nodiscard]] static Result<AttackVfxRecipe> fromJson(std::string_view json);
204
206 [[nodiscard]] Result<std::string> toJson() const;
207
209 [[nodiscard]] Result<void> validate() const;
210};
211
217public:
219 explicit AttackVfxRecipeSlot(AttackVfxRecipe recipe);
220
222 [[nodiscard]] Result<std::uint64_t> reload(std::string_view json);
224 [[nodiscard]] const AttackVfxRecipe& recipe() const noexcept { return recipe_; }
226 [[nodiscard]] std::uint64_t revision() const noexcept { return revision_; }
227
228private:
229 AttackVfxRecipe recipe_;
230 std::uint64_t revision_ = 1;
231};
232
234[[nodiscard]] EVENGINE_API_WORLD std::string_view attackVfxPhaseKindName(AttackVfxPhaseKind kind) noexcept;
236[[nodiscard]] EVENGINE_API_WORLD std::string_view attackVfxLayerRoleName(AttackVfxLayerRole role) noexcept;
238[[nodiscard]] EVENGINE_API_WORLD std::string_view attackVfxStopBehaviorName(AttackVfxStopBehavior behavior) noexcept;
240[[nodiscard]] EVENGINE_API_WORLD std::string_view attackVfxSpatialAttachmentName(
241 AttackVfxSpatialAttachment mode) noexcept;
243[[nodiscard]] EVENGINE_API_WORLD std::string_view attackVfxSpatialAnchorName(AttackVfxSpatialAnchor anchor) noexcept;
244
245} // namespace eve::stylize
Vec3 anchor
Definition CaveMesh.cpp:90
#define EVENGINE_API_WORLD
Definition Export.h:109
Strong identity values shared by persistence, content and logical-name APIs.
TokenKind kind
std::array< float, 3 > scale
std::string path
Definition PlayHost.cpp:110
Move-only, checked operation results for the common layer.
Human-readable, scoped identifier in the form namespace:name.
Definition Identity.h:411
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Structured status and zero or more diagnostics for an operation.
Definition Status.h:68
Transactional hot-reload boundary for one attack VFX recipe. A failed reload preserves both the previ...
std::uint64_t revision() const noexcept
Monotonic successful-reload revision, starting at one.
const AttackVfxRecipe & recipe() const noexcept
Current immutable recipe snapshot.
AttackVfxLayerRole
Which existing presentation backend a layer binds to.
AttackVfxSpatialAttachment
How a layer follows its resolved spatial anchor.
AttackVfxPhaseKind
Attack presentation phase along the cast → hit → linger timeline.
std::string_view attackVfxSpatialAnchorName(AttackVfxSpatialAnchor anchor) noexcept
Stable JSON spelling for spatial anchor.
AttackVfxStopBehavior
Exit policy when a phase or instance stops.
std::string_view attackVfxSpatialAttachmentName(AttackVfxSpatialAttachment mode) noexcept
Stable JSON spelling for spatial attachment.
AttackVfxSpatialAnchor
Which request endpoint supplies the spatial anchor.
std::string_view attackVfxPhaseKindName(AttackVfxPhaseKind kind) noexcept
Stable JSON spelling for a phase kind.
std::string_view attackVfxLayerRoleName(AttackVfxLayerRole role) noexcept
Stable JSON spelling for a layer role.
std::string_view attackVfxStopBehaviorName(AttackVfxStopBehavior behavior) noexcept
Stable JSON spelling for stop behavior.
Optional quality / budget knobs evaluated by later executor phases.
auto operator<=>(const AttackVfxBudget &) const =default
Operator <=>.
One presentation layer slot inside a phase.
std::map< std::string, float > floatParams
RGB palette used as a skin tint (components in [0, 1]).
auto operator<=>(const AttackVfxPalette &) const =default
Operator <=>.
One timeline phase that owns zero or more layers.
std::vector< AttackVfxLayer > layers
Versioned attack VFX composition recipe.
std::optional< LogicalId > skinId
std::optional< AttackVfxSkin > skin
std::vector< AttackVfxPhase > phases
Reusable elemental / style skin applied at play time.
std::map< std::string, float > distortionProfile
std::map< std::string, std::string > styleHints
std::map< std::string, float > shakeProfile
Backend-neutral spatial binding stored on a layer.
auto operator<=>(const AttackVfxSpatial &) const =default
Operator <=>.
Owning three-component float used at the recipe boundary.
auto operator<=>(const AttackVfxVec3 &) const =default
Operator <=>.