Struct SparseWeight8

SparseWeight8 structure

Represents a sparse collection of non zero weight values, with a maximum of 8 weights.

public struct SparseWeight8 : IEquatable<SparseWeight8>

Properties

NameDescription
Count { get; }
IsWeightless { get; }Gets a value indicating whether all the weights in this SparseWeight8 are zero.
Item { get; }
MaxIndex { get; }
WeightSum { get; }

Methods

NameDescription
static Add(ref SparseWeight8, ref SparseWeight8)Adds x with y element wise. If there’s more than 8 non zero result values, the 8 most representative values are taken.
static Blend(ReadOnlySpan<SparseWeight8>, ReadOnlySpan<float>)
static Create(params (int Index, float Weight)[])Creates a new SparseWeight8 from an indexed weight collection. If there’s more than 8 weighted values, the 8 heaviest values are taken.
static Create(params float[])Creates a new SparseWeight8 from a weights collection. If there’s more than 8 non zero values, the 8 most representative values are taken.
static Create(IEnumerable<(int Index, float Weight)>)Creates a new SparseWeight8 from an indexed weight collection. If there’s more than 8 weighted values, the 8 heaviest values are taken.
static Create(IEnumerable<float>)Creates a new SparseWeight8 from a weights collection. If there’s more than 8 weighted values, the 8 heaviest values are taken.
static Create(ref Vector4, ref Vector4)Creates a new SparseWeight8 struct.
static Create(ref Vector4, ref Vector4, ref Vector4, ref Vector4)Creates a new SparseWeight8 struct.
static CreateUnchecked(ref Vector4, ref Vector4, ref Vector4, ref Vector4)Creates a new SparseWeight8 struct.
static InterpolateCubic(ref SparseWeight8, ref SparseWeight8, ref SparseWeight8, ref SparseWeight8, float)Interpolates (x , xt) with (y , yt) an amount. If there’s more than 8 non zero result values, the 8 most representative values are taken.
static InterpolateLinear(ref SparseWeight8, ref SparseWeight8, float)Interpolates Linearly x with y an amount. If there’s more than 8 non zero result values, the 8 most representative values are taken.
static Multiply(ref SparseWeight8, float)Multiplies x with y element wise. If there’s more than 8 non zero result values, the 8 most representative values are taken.
static Multiply(ref SparseWeight8, ref SparseWeight8)Multiplies x with y element wise. If there’s more than 8 non zero result values, the 8 most representative values are taken.
static OrderedByIndex(ref SparseWeight8)Returns a copy of this SparseWeight8 where all the indices have been reordered by index in ascending order.
static OrderedByWeight(ref SparseWeight8)Returns a copy of this SparseWeight8 where all the indices have been reordered by weight in descending order.
static Subtract(ref SparseWeight8, ref SparseWeight8)Subtracts y from x element wise. If there’s more than 8 non zero result values, the 8 most representative values are taken.
override Equals(object)
Equals(SparseWeight8)
Expand(int)
override GetHashCode()
GetIndexedWeights()
GetNormalized()
GetTrimmed(int)
override ToString()
operator ==
operator !=

Fields

NameDescription
readonly Index0
readonly Index1
readonly Index2
readonly Index3
readonly Index4
readonly Index5
readonly Index6
readonly Index7
readonly Weight0
readonly Weight1
readonly Weight2
readonly Weight3
readonly Weight4
readonly Weight5
readonly Weight6
readonly Weight7

Remarks

SparseWeight8 is being used in two different contexts:

  • As an utility structure to define per vertex joint weights in mesh skinning.
  • As an animation key in morph targets; a mesh can have many morph targets, but realistically and due to GPU limitations, only up to 8 morph targets can be blended at the same time.

Constructors are designed so weightless values are not taken into account, and duplicated indices are merged, so indices are expected to be unique.

Use static Create* methods to construct instances of SparseWeight8.

See Also