载入中...
搜索中...
未找到
ActionParameterCurve.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
8
9#include <cstdint>
10#include <optional>
11#include <string>
12#include <string_view>
13#include <vector>
14
15namespace eve::action {
16
18enum class ActionParameterInterpolation : std::uint8_t { Step, Linear, Cubic };
19
21enum class ActionParameterOperation : std::uint8_t { Replace, Add, Multiply };
22
26 double time = 0.0;
28 double value = 0.0;
30 double inTangent = 0.0;
32 double outTangent = 0.0;
35
37 auto operator<=>(const ActionParameterKey&) const = default;
38};
39
45 ActionParameterOperation operation = ActionParameterOperation::Replace;
47 std::vector<ActionParameterKey> keys;
48
50 auto operator<=>(const ActionParameterCurveBinding&) const = default;
51
53 [[nodiscard]] static Result<ActionParameterCurveBinding> fromPayload(const Value::Object& payload);
55 [[nodiscard]] Value::Object toPayload(Value::Object extensions = {}) const;
57 [[nodiscard]] double sample(double progress) const noexcept;
58};
59
61[[nodiscard]] EVENGINE_API_PLATFORM std::string_view actionParameterInterpolationName(
64[[nodiscard]] EVENGINE_API_PLATFORM std::optional<ActionParameterInterpolation> actionParameterInterpolationFromName(
65 std::string_view value) noexcept;
67[[nodiscard]] EVENGINE_API_PLATFORM std::string_view actionParameterOperationName(
69
71enum class ActionParameterPhase : std::uint8_t { Begin, Update, End };
72
90
99public:
100 static constexpr const char* capabilityName = "IActionParameterSink";
102 virtual ~IActionParameterSink() = default;
103
105 [[nodiscard]] virtual bool supports(const LogicalId& target) const noexcept = 0;
107 [[nodiscard]] virtual Result<void> apply(const ActionParameterSample& sample) = 0;
108};
109
110} // namespace eve::action
LogicalId target
ActionParameterOperation operation
double value
Extensible notify descriptors, validation and runtime routing.
Value::Object payload
#define EVENGINE_API_PLATFORM
Definition Export.h:107
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
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.