75 std::array<AnimSlot, k_numSlots>
slots{};
89 const auto& sa = a.
slots[i];
90 const auto& sb = b.
slots[i];
91 const bool aActive = sa.weight > 0.0f;
92 const bool bActive = sb.weight > 0.0f;
93 if (aActive != bActive) {
102 if (sa.clipIdRaw != sb.clipIdRaw) {
108 const float maxW = std::max(sa.weight, sb.weight);
109 d += std::abs(sa.timeRatio - sb.timeRatio) * maxW;
110 d += std::abs(sa.weight - sb.weight) * 0.5f;
122 const float tClamped = std::max(0.0f, std::min(1.0f, s.
timeRatio));
123 const float wClamped = std::max(0.0f, std::min(1.0f, s.
weight));
124 const auto tq =
static_cast<std::uint16_t
>(std::lround(tClamped * 65535.0f));
125 const auto wq =
static_cast<std::uint8_t
>(std::lround(wClamped * 255.0f));
126 out[1] =
static_cast<std::uint8_t
>(tq & 0xFFu);
127 out[2] =
static_cast<std::uint8_t
>((tq >> 8) & 0xFFu);
135 const std::uint16_t tq =
136 static_cast<std::uint16_t
>(
static_cast<std::uint16_t
>(in[1]) |
static_cast<std::uint16_t
>(in[2] << 8));
137 s.
timeRatio =
static_cast<float>(tq) / 65535.0f;
138 s.
weight =
static_cast<float>(in[3]) / 255.0f;
Definition AnimSnapshot.hpp:79
AnimSlot unpack(const std::uint8_t in[4])
Definition AnimSnapshot.hpp:131
AnimSnapshot unpackSnapshot(const std::uint8_t in[k_wireSize])
Definition AnimSnapshot.hpp:151
float delta(const AnimSnapshot &a, const AnimSnapshot &b)
PR-27 animation-state delta.
Definition AnimSnapshot.hpp:85
constexpr std::size_t k_wireSize
Total wire size of an AnimSnapshot (5 slots × 4 bytes).
Definition AnimSnapshot.hpp:143
void pack(const AnimSlot &s, std::uint8_t out[4])
Pack one AnimSlot into 4 bytes for wire transmission.
Definition AnimSnapshot.hpp:119
void packSnapshot(const AnimSnapshot &snap, std::uint8_t out[k_wireSize])
Definition AnimSnapshot.hpp:145
One slot in an entity's blend stack.
Definition AnimSnapshot.hpp:48
float timeRatio
Normalised playhead position in [0, 1] over the clip's duration.
Definition AnimSnapshot.hpp:56
float weight
Blend weight in [0, 1].
Definition AnimSnapshot.hpp:60
std::uint8_t clipIdRaw
Raw uint8_t cast of ClipId.
Definition AnimSnapshot.hpp:52
Snapshot of an entity's full animation state at one instant.
Definition AnimSnapshot.hpp:73
static constexpr std::size_t k_numSlots
Definition AnimSnapshot.hpp:74
std::array< AnimSlot, k_numSlots > slots
Definition AnimSnapshot.hpp:75
PR-27: transient component placed on the shooter entity for the duration of one runWeapon invocation ...
Definition AnimSnapshot.hpp:177
std::uint16_t targetClientId
Definition AnimSnapshot.hpp:179
bool received
Definition AnimSnapshot.hpp:178
AnimSnapshot targetAnim
Definition AnimSnapshot.hpp:180