Pull IkChainIdx from animation channel flags

This commit is contained in:
Ammar Askar 2023-08-23 14:09:36 -04:00
parent 1da81c10d6
commit 2cb6db9369

View file

@ -101,12 +101,16 @@ namespace OpenTS2.Files.Formats.DBPF.Scenegraph.Block
? (ChannelType)ChannelTypeBits
: throw new InvalidCastException($"Channel type has invalid value: {ChannelTypeBits}");
// Calculated from the top 8 bits of the most-significant byte of ChannelFlags.
// Calculated from the top 3 bits of the most-significant byte of ChannelFlags.
public uint NumComponents => (ChannelFlags >> 29) & 0b111;
// Bottom 15 bits give the channel duration.
public uint DurationTicks => ChannelFlags & 0x7FFF;
// Bits 1 to 5 of the most-significant byte are the ik chain idx for this channel.
private uint IKChainIdxBits => (ChannelFlags >> 25) & 0b1111;
public int IKChainIdx => IKChainIdxBits == 0b1111 ? -1 : (int)IKChainIdxBits;
public ChannelComponent[] Components;
}