UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::MorphTargetVertexCodec Namespace Reference

Classes

struct  FDeltaBatchHeader
 
class  FDwordBitReader
 
class  FDwordBitWriter
 
class  FDwordViewBitWriter
 
struct  FQuantizedDelta
 

Functions

void Encode (TConstArrayView< FMorphTargetDelta > InMorphDeltas, const TBitArray<> *InVertexNeedsTangents, const float InPositionPrecision, const float InTangentZPrecision, TArray< FDeltaBatchHeader > &OutBatchHeaders, TArray< uint32 > &OutCompressedVertices)
 
void Decode (TConstArrayView< FDeltaBatchHeader > InBatchHeaders, TConstArrayView< uint32 > InCompressedVertices, const float InPositionPrecision, const float InTangentZPrecision, TArray< FMorphTargetDelta > &OutMorphDeltas)
 
bool IterativeDecode (uint64 &InOutNextItemToken, TConstArrayView< FDeltaBatchHeader > InBatchHeaders, TConstArrayView< uint32 > InCompressedVertices, const float InPositionPrecision, const float InTangentZPrecision, FMorphTargetDelta &OutMorphTargetDelta)
 
void WriteHeader (const FDeltaBatchHeader &InBatchHeader, TArrayView< uint32 > OutData)
 
void ReadHeader (FDeltaBatchHeader &OutBatchHeader, TConstArrayView< uint32 > InData)
 
void WriteQuantizedDeltas (TConstArrayView< FQuantizedDelta > InQuantizedDeltas, const FDeltaBatchHeader &InBatchHeader, TArrayView< uint32 > OutData)
 
void ReadQuantizedDeltas (TArrayView< FQuantizedDelta > OutQuantizedDeltas, const FDeltaBatchHeader &InBatchHeader, TConstArrayView< uint32 > InData)
 
uint32 CalculateBatchDwords (const FDeltaBatchHeader &InBatchHeader)
 
void QuantizeDelta (const FMorphTargetDelta &InDelta, const bool bInNeedsTangent, FQuantizedDelta &OutQuantizedDelta, const float InPositionPrecision, const float InTangentZPrecision)
 
void DequantizeDelta (FMorphTargetDelta &OutDelta, const bool bInNeedsTangent, const FQuantizedDelta &InQuantizedDelta, const float InPositionPrecision, const float InTangentZPrecision)
 
float ComputePositionPrecision (float InTargetPositionErrorTolerance)
 
float ComputeTangentPrecision ()
 
ENGINE_API void ReadHeader (FDeltaBatchHeader &OutBatchHeader, const TArrayView< const uint32 > InData)
 

Variables

constexpr uint32 IndexMaxBits = 31u
 
constexpr uint32 PositionMaxBits = 28u
 
constexpr float PositionMinValue = -134217728.0f
 
constexpr float PositionMaxValue = 134217720.0f
 
constexpr uint32 TangentZMaxBits = 16u
 
constexpr float TangentZMinValue = -32768.0f
 
constexpr float TangentZMaxValue = 32767.0f
 
constexpr uint32 BatchSizeBits = 6u
 
constexpr uint32 BatchSize = 1u << BatchSizeBits
 
constexpr uint32 NumBatchHeaderDwords = 10u
 

Function Documentation

◆ CalculateBatchDwords()

ENGINE_API uint32 UE::MorphTargetVertexCodec::CalculateBatchDwords ( const FDeltaBatchHeader BatchHeader)

Calculates the number of Dwords the batch data has from BatchHeader.

◆ ComputePositionPrecision()

float UE::MorphTargetVertexCodec::ComputePositionPrecision ( float  InTargetPositionErrorTolerance)
inline

◆ ComputeTangentPrecision()

float UE::MorphTargetVertexCodec::ComputeTangentPrecision ( )
inline

◆ Decode()

ENGINE_API void UE::MorphTargetVertexCodec::Decode ( TConstArrayView< FDeltaBatchHeader InBatchHeaders,
TConstArrayView< uint32 InCompressedVertices,
const float  InPositionPrecision,
const float  InTangentZPrecision,
TArray< FMorphTargetDelta > &  OutMorphDeltas 
)

Decode all the vertices given by the two arrays.

◆ DequantizeDelta()

ENGINE_API void UE::MorphTargetVertexCodec::DequantizeDelta ( FMorphTargetDelta OutDelta,
const bool  bInNeedsTangent,
const FQuantizedDelta InQuantizedDelta,
const float  InPositionPrecision,
const float  InTangentZPrecision 
)

◆ Encode()

ENGINE_API void UE::MorphTargetVertexCodec::Encode ( TConstArrayView< FMorphTargetDelta InMorphDeltas,
const TBitArray<> *  InVertexNeedsTangents,
const float  InPositionPrecision,
const float  InTangentZPrecision,
TArray< FDeltaBatchHeader > &  OutBatchHeaders,
TArray< uint32 > &  OutCompressedVertices 
)

Encodes the morph deltas, using the given precision, into a pair of arrays – one to store the header data that describes a bit-packed batch of vertices and another that stores the actual bit packed vertices themselves. Note that due to the compressor throwing away deltas that are under the precision threshold, the number of output deltas may not match the number of deltas that end up getting packed.

Parameters
InMorphDeltasThe list of morph deltas that will be compressed.
InVertexNeedsTangentsAn optional bit array of vertices that require tangents to be present. If nullptr, then all vertices are assumed to require tangents. Used to ignore compressing tangents on sections that compute them automatically at render time.
InPositionPrecisionThe precision required for the compression the position data. The greater this value the fewer bits are used for storing the resulting position values.
InTangentZPrecisionThe precision required for the compression the tangent data. The greater this value the fewer bits are used for storing the resulting tangent values.
OutBatchHeadersThe list of block headers for each compressed block of morph deltas. Multiple headers are required since the final amount of bits required is dependent on the spread of position/tangent values within each block.
OutCompressedVerticesThe actual compressed data.

◆ IterativeDecode()

ENGINE_API bool UE::MorphTargetVertexCodec::IterativeDecode ( uint64 InOutNextItemToken,
TConstArrayView< FDeltaBatchHeader InBatchHeaders,
TConstArrayView< uint32 InCompressedVertices,
const float  InPositionPrecision,
const float  InTangentZPrecision,
FMorphTargetDelta OutMorphTargetDelta 
)

Iteratively decode a single morph target delta entry from the data stream. The InOutNextItemToken is an opaque value that should be initialized to zero for the first entry. It will be adjusted to point to the next entry after a successful decode.

◆ QuantizeDelta()

ENGINE_API void UE::MorphTargetVertexCodec::QuantizeDelta ( const FMorphTargetDelta InDelta,
const bool  bInNeedsTangent,
FQuantizedDelta OutQuantizedDelta,
const float  InPositionPrecision,
const float  InTangentZPrecision 
)

Quantize FMorphTargetDelta using the given precision.

◆ ReadHeader() [1/2]

ENGINE_API void UE::MorphTargetVertexCodec::ReadHeader ( FDeltaBatchHeader OutBatchHeader,
const TArrayView< const uint32 InData 
)

Reads and decodes OutBatchHeader bits from InData.

◆ ReadHeader() [2/2]

void UE::MorphTargetVertexCodec::ReadHeader ( FDeltaBatchHeader OutBatchHeader,
TConstArrayView< uint32 InData 
)

◆ ReadQuantizedDeltas()

ENGINE_API void UE::MorphTargetVertexCodec::ReadQuantizedDeltas ( TArrayView< FQuantizedDelta OutQuantizedDeltas,
const FDeltaBatchHeader InBatchHeader,
TConstArrayView< uint32 InData 
)

Reads and decodes the batch quantized data from InData to OutQuantizeDeletas. InData must be sufficiently large to hold the number of Dwords specified by InBatchHeader.

◆ WriteHeader()

ENGINE_API void UE::MorphTargetVertexCodec::WriteHeader ( const FDeltaBatchHeader InBatchHeader,
TArrayView< uint32 OutData 
)

Encodes and writes InBatchHeader bits to OutData.

◆ WriteQuantizedDeltas()

ENGINE_API void UE::MorphTargetVertexCodec::WriteQuantizedDeltas ( TConstArrayView< FQuantizedDelta InQuantizedDeltas,
const FDeltaBatchHeader InBatchHeader,
TArrayView< uint32 OutData 
)

Encodes and writes the batch quantized data from InQuantizeDeletas to OutData. OutData must be sufficiently large to hold the number of Dwords specified by InBatchHeader.

Variable Documentation

◆ BatchSize

constexpr uint32 UE::MorphTargetVertexCodec::BatchSize = 1u << BatchSizeBits
constexpr

◆ BatchSizeBits

constexpr uint32 UE::MorphTargetVertexCodec::BatchSizeBits = 6u
constexpr

◆ IndexMaxBits

constexpr uint32 UE::MorphTargetVertexCodec::IndexMaxBits = 31u
constexpr

◆ NumBatchHeaderDwords

constexpr uint32 UE::MorphTargetVertexCodec::NumBatchHeaderDwords = 10u
constexpr

◆ PositionMaxBits

constexpr uint32 UE::MorphTargetVertexCodec::PositionMaxBits = 28u
constexpr

◆ PositionMaxValue

constexpr float UE::MorphTargetVertexCodec::PositionMaxValue = 134217720.0f
constexpr

◆ PositionMinValue

constexpr float UE::MorphTargetVertexCodec::PositionMinValue = -134217728.0f
constexpr

◆ TangentZMaxBits

constexpr uint32 UE::MorphTargetVertexCodec::TangentZMaxBits = 16u
constexpr

◆ TangentZMaxValue

constexpr float UE::MorphTargetVertexCodec::TangentZMaxValue = 32767.0f
constexpr

◆ TangentZMinValue

constexpr float UE::MorphTargetVertexCodec::TangentZMinValue = -32768.0f
constexpr