class

FAnimTrackCodec

Module
Animation
Header
#include "Animation/AnimationCompression.h"
Namespace
Mowo

Properties

TypeNameDescription
static constexpr floatkUnitQuantStepHalf a quantization step, expressed as a fraction of the encoded range. Every error bound quoted on this codec is derived from it. Default 1.0f / 65535.0f.
static constexpr uint8_tkPackedFormatBaseVariable bit rate, per track (ACL's per-track bit rates): a quantized track that still meets its tolerance with fewer than 16 bits per component is bit-packed at the narrowest width that does. The width rides in the format byte, kPackedFormatBase + bits, so neither the .mmodel channel header nor a cooked descriptor grows a field. A packed vector key is a 16-bit time word plus three bits-wide axes; a packed rotation key is the time word, the 2-bit largest-component index and three bits-wide smallest-three components. Default 16.
static constexpr uint32_tkMinPackedBitsDefault 3.
static constexpr uint32_tkMaxPackedBitsDefault 15.

Public functions

ReturnsNameDescription
boolIsPacked
uint32_tPackedBits
EAnimTrackFormatPackedFormat
uint32_tPackedVectorKeyBits
uint32_tPackedRotationKeyBits
uint16_tEncodeUnit
floatDecodeUnit
uint16_tEncodeRanged
floatDecodeRanged
voidEncodeQuatSmallest-three: a unit quaternion's largest component is recoverable from the other three, so we store 2 bits of index plus three 15-bit components over [-1/sqrt(2), +1/sqrt(2)] — 47 bits, written as 6 bytes.
QuatDecodeQuat
FCompressedAnimTrackCompressVectorTrackEncode one vector track into blob, returning its descriptor.
FCompressedAnimTrackCompressRotationTrack
FCompressedAnimTrackCompressVectorTrackVbrCompressVectorTrack, then the narrowest bit-packed width whose measured error still meets tolerance — taken only when it is smaller.
FCompressedAnimTrackCompressRotationTrackVbr
Vec3SampleVectorSample straight out of the encoded bytes: binary search over the quantized time words, dequantize the two bracketing keys, lerp.
QuatSampleRotation
voidDecompressVectorTrackRebuild the lossless key list — used by tooling and by the .mmodel loader, which must keep handing every existing consumer raw keys.
voidDecompressRotationTrack
uint64_tVectorTrackBytes
uint64_tRotationTrackBytes
uint32_tVectorStride
uint32_tRotationStride
floatMaxAxisDelta
floatMaxQuatDeltaQuaternion distance as the largest component difference after sign alignment: q and -q name one rotation, so comparing them raw would report a maximal error for an identical pose.

Function details

IsPacked

C++
static bool IsPacked(EAnimTrackFormat format)

PackedBits

C++
static uint32_t PackedBits(EAnimTrackFormat format)

PackedFormat

C++
static EAnimTrackFormat PackedFormat(uint32_t bits)

PackedVectorKeyBits

C++
static uint32_t PackedVectorKeyBits(uint32_t bits)

PackedRotationKeyBits

C++
static uint32_t PackedRotationKeyBits(uint32_t bits)

EncodeUnit

C++
static uint16_t EncodeUnit(float unit)

DecodeUnit

C++
static float DecodeUnit(uint16_t q)

EncodeRanged

C++
static uint16_t EncodeRanged(float value, float rangeMin, float rangeExtent)

DecodeRanged

C++
static float DecodeRanged(uint16_t q, float rangeMin, float rangeExtent)

EncodeQuat

C++
static void EncodeQuat(const Quat& in, uint8_t out[6])

Smallest-three: a unit quaternion's largest component is recoverable from the other three, so we store 2 bits of index plus three 15-bit components over [-1/sqrt(2), +1/sqrt(2)] — 47 bits, written as 6 bytes. The sign is folded away by flipping q so the largest component is positive, which costs nothing (q and -q are the same rotation).

DecodeQuat

C++
static Quat DecodeQuat(const uint8_t in[6])

CompressVectorTrack

C++
static FCompressedAnimTrack CompressVectorTrack(const std::vector<FAnimVectorKeyIn>& keys, float tolerance, bool collapseConstant, std::vector<uint8_t>& blob, float& outMaxError, bool& outCollapsed)

Encode one vector track into blob, returning its descriptor. The returned format is Quantized only when the round trip measured against the original keys stays inside tolerance; otherwise the raw floats go in instead and the track is byte-exact.

CompressRotationTrack

C++
static FCompressedAnimTrack CompressRotationTrack(const std::vector<FAnimRotationKeyIn>& keys, float tolerance, bool collapseConstant, std::vector<uint8_t>& blob, float& outMaxError, bool& outCollapsed)

CompressVectorTrackVbr

C++
static FCompressedAnimTrack CompressVectorTrackVbr(const std::vector<FAnimVectorKeyIn>& keys, float tolerance, bool collapseConstant, std::vector<uint8_t>& blob, float& outMaxError, bool& outCollapsed)

CompressVectorTrack, then the narrowest bit-packed width whose measured error still meets tolerance — taken only when it is smaller. A track the fixed form stores raw, empty or collapsed to one key stays as it is.

CompressRotationTrackVbr

C++
static FCompressedAnimTrack CompressRotationTrackVbr(const std::vector<FAnimRotationKeyIn>& keys, float tolerance, bool collapseConstant, std::vector<uint8_t>& blob, float& outMaxError, bool& outCollapsed)

SampleVector

C++
static Vec3 SampleVector(const FCompressedAnimTrack& track, const uint8_t* blobBase, float timeTicks, const Vec3& fallback)

Sample straight out of the encoded bytes: binary search over the quantized time words, dequantize the two bracketing keys, lerp. No intermediate decompressed track is ever materialized — that whole-track decode is what makes most compressed-animation schemes unusable at runtime, and the reason this one is byte-addressable per key.

SampleRotation

C++
static Quat SampleRotation(const FCompressedAnimTrack& track, const uint8_t* blobBase, float timeTicks, const Quat& fallback)

DecompressVectorTrack

C++
static void DecompressVectorTrack(const FCompressedAnimTrack& track, const uint8_t* blobBase, std::vector<FAnimVectorKeyIn>& out)

Rebuild the lossless key list — used by tooling and by the .mmodel loader, which must keep handing every existing consumer raw keys.

DecompressRotationTrack

C++
static void DecompressRotationTrack(const FCompressedAnimTrack& track, const uint8_t* blobBase, std::vector<FAnimRotationKeyIn>& out)

VectorTrackBytes

C++
static uint64_t VectorTrackBytes(const FCompressedAnimTrack& track)

RotationTrackBytes

C++
static uint64_t RotationTrackBytes(const FCompressedAnimTrack& track)

VectorStride

C++
static uint32_t VectorStride(EAnimTrackFormat format)

RotationStride

C++
static uint32_t RotationStride(EAnimTrackFormat format)

MaxAxisDelta

C++
static float MaxAxisDelta(const Vec3& a, const Vec3& b)

MaxQuatDelta

C++
static float MaxQuatDelta(const Quat& a, const Quat& in)

Quaternion distance as the largest component difference after sign alignment: q and -q name one rotation, so comparing them raw would report a maximal error for an identical pose.

Generated from Animation/AnimationCompression.h via animation.json · Oct 26, 2026Version 1.0.0