载入中...
搜索中...
未找到
ActionParameterCurve.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
12
13#include <cstdint>
14#include <optional>
15#include <string>
16#include <string_view>
17#include <vector>
18
19namespace eve::action {
20
22enum class ActionParameterInterpolation : std::uint8_t { Step, Linear, Cubic };
23
25enum class ActionParameterOperation : std::uint8_t { Replace, Add, Multiply };
26
30 double time = 0.0;
32 double value = 0.0;
34 double inTangent = 0.0;
36 double outTangent = 0.0;
39
41 auto operator<=>(const ActionParameterKey&) const = default;
42};
43
49 ActionParameterOperation operation = ActionParameterOperation::Replace;
51 std::vector<ActionParameterKey> keys;
52
54 auto operator<=>(const ActionParameterCurveBinding&) const = default;
55
57 [[nodiscard]] static Result<ActionParameterCurveBinding> fromPayload(const Value::Object& payload);
59 [[nodiscard]] Value::Object toPayload(Value::Object extensions = {}) const;
61 [[nodiscard]] double sample(double progress) const noexcept;
62};
63
65[[nodiscard]] EVENGINE_API_PLATFORM std::string_view actionParameterInterpolationName(
68[[nodiscard]] EVENGINE_API_PLATFORM std::optional<ActionParameterInterpolation> actionParameterInterpolationFromName(
69 std::string_view value) noexcept;
71[[nodiscard]] EVENGINE_API_PLATFORM std::string_view actionParameterOperationName(
73
75enum class ActionParameterPhase : std::uint8_t { Begin, Update, End };
76
94
103public:
104 static constexpr const char* capabilityName = "IActionParameterSink";
106 virtual ~IActionParameterSink() = default;
107
109 [[nodiscard]] virtual bool supports(const LogicalId& target) const noexcept = 0;
111 [[nodiscard]] virtual Result<void> apply(const ActionParameterSample& sample) = 0;
112};
113
114} // namespace eve::action
LogicalId target
ActionParameterOperation operation
Extensible notify descriptors, validation and runtime routing.
Value::Object payload
#define EVENGINE_API_PLATFORM
Definition Export.h:107
Object::Ptr value
Human-readable, scoped identifier in the form namespace:name.
Definition Identity.h:414
Move-only operation result carrying either a value or Status.
Definition Result.h:176
std::map< std::string, Value > Object
Definition Value.h:34
Optional open target for continuous action parameters.
virtual Result< void > apply(const ActionParameterSample &sample)=0
Apply one borrowed lifecycle sample and report any target failure.
virtual ~IActionParameterSink()=default
Releases IActionParameterSink resources.
virtual bool supports(const LogicalId &target) const noexcept=0
Whether this sink owns the supplied stable target.
static constexpr const char * capabilityName
ActionParameterInterpolation
Interpolation used from one parameter key to the following key.
std::optional< ActionParameterInterpolation > actionParameterInterpolationFromName(std::string_view value) noexcept
Parse a stable persisted interpolation spelling.
std::string_view actionParameterOperationName(ActionParameterOperation value) noexcept
Stable persisted operation spelling.
ActionParameterOperation
Composition operation applied by a target-specific parameter sink.
ActionParameterPhase
Parameter lifecycle projected to a target-specific optional sink.
std::string_view actionParameterInterpolationName(ActionParameterInterpolation value) noexcept
Stable persisted interpolation spelling.
Validated owning continuous parameter binding.
LogicalId target
Stable sink-owned parameter target.
auto operator<=>(const ActionParameterCurveBinding &) const =default
Operator <=>.
std::vector< ActionParameterKey > keys
Strictly ordered normalized keys, including endpoints 0 and 1.
One normalized, owning parameter-curve key.
double value
Authored scalar value.
double time
Normalized key time in [0, 1].
ActionParameterInterpolation interpolation
Interpolation from this key to the following key.
auto operator<=>(const ActionParameterKey &) const =default
Operator <=>.
double outTangent
Outgoing value-per-normalized-time tangent for cubic interpolation.
double inTangent
Incoming value-per-normalized-time tangent for cubic interpolation.
Owning continuous parameter sample emitted by ActionBlockRuntime.
LogicalId itemId
Stable timeline item identity within the execution.
bool preview
Whether the sample belongs to non-authoritative preview evaluation.
double value
Evaluated scalar value.
ActionParameterPhase phase
Paired lifecycle phase.
LogicalId target
Stable sink-owned parameter target.
ActionExecutionId executionId
Generation-qualified action execution identity.
ActionParameterOperation operation
Composition operation for this curve.