public static W3dAdaptiveDeltaAnimationChannel Parse(BinaryReader reader, int nBits) { var startPosition = reader.BaseStream.Position; var result = new W3dAdaptiveDeltaAnimationChannel { NumTimeCodes = reader.ReadUInt32(), Pivot = reader.ReadUInt16(), VectorLength = reader.ReadByte(), ChannelType = EnumUtility.CastValueAsEnum <byte, W3dAnimationChannelType>(reader.ReadByte()), Scale = reader.ReadSingle(), }; W3dAnimationChannel.ValidateChannelDataSize(result.ChannelType, result.VectorLength); result.Data = W3dAdaptiveDelta.ReadAdaptiveDelta(reader, result.NumTimeCodes, result.ChannelType, result.VectorLength, result.Scale, nBits); //Skip 3 unknown bytes at chunkend. Only set for quaternions. reader.BaseStream.Seek(3, SeekOrigin.Current); return(result); }
public static W3dMotionChannelAdaptiveDeltaData Parse(BinaryReader reader, uint numTimeCodes, W3dAnimationChannelType channelType, int vectorLen, int nBits) { float scale = reader.ReadSingle(); var data = W3dAdaptiveDelta.ReadAdaptiveDelta(reader, numTimeCodes, channelType, vectorLen, scale, nBits); var keyframes = new ushort[numTimeCodes]; for (ushort i = 0; i < numTimeCodes; i++) { keyframes[i] = i; } return(new W3dMotionChannelAdaptiveDeltaData { TimeCodes = keyframes, Values = data }); }