Vixen
02b45cc4
csharp
public ref struct PoseBlend.Accumulator

A weighted average of poses, built one pose at a time.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Each Add interpolates the running result towards the new pose by w / (total + w), which for translations and scales is exactly the weighted mean and is independent of the order they arrive in. For rotations it is not — a chain of nlerps depends on its order, because there is no cheap operation on quaternions that both averages and stays on the unit sphere. Every engine does this; the error is below the precision of the input for the weights a blend tree produces, and the alternative is an eigen-decomposition per joint per frame.

A ref struct so it cannot outlive the span it writes into, and so that accumulating a blend costs a stack slot and no allocation.

Fields and properties (1)

  • public readonly float TotalWeight

    The weights added so far. Zero means nothing has contributed.

Methods (2)

  • public void Add(ReadOnlySpan<BoneTransform> pose, float weight)

    Folds one pose in.

  • public bool Finish(ReadOnlySpan<BoneTransform> fallback)

    Fills the destination with a fallback if nothing contributed, and reports whether anything did.

Used by (3)

  • BlendEvaluatorVixen.Animation
  • PoseBlendVixen.Animation
  • PoseBlendTestsVixen.Animation.Tests