public KeyFrameStreamReader(Stream stream) { _reader = new BinaryReader(stream); _scaleFactor = _reader.ReadSingle(); _translationFactor = _reader.ReadSingle(); // Read keyframe 0 var boneIds = new List <short>(); var boneStates = new List <KeyFrameBoneState>(); short boneId = _reader.ReadInt16(); while (boneId >= 0) { boneIds.Add(boneId); var boneState = new KeyFrameBoneState(); boneState.Scale.X = _scaleFactor * _reader.ReadInt16(); boneState.Scale.Y = _scaleFactor * _reader.ReadInt16(); boneState.Scale.Z = _scaleFactor * _reader.ReadInt16(); boneState.Rotation.X = RotationFactor * _reader.ReadInt16(); boneState.Rotation.Y = RotationFactor * _reader.ReadInt16(); boneState.Rotation.Z = RotationFactor * _reader.ReadInt16(); boneState.Rotation.W = RotationFactor * _reader.ReadInt16(); boneState.Translation.X = _translationFactor * _reader.ReadInt16(); boneState.Translation.Y = _translationFactor * _reader.ReadInt16(); boneState.Translation.Z = _translationFactor * _reader.ReadInt16(); boneStates.Add(boneState); boneId = _reader.ReadInt16(); } BoneIds = boneIds.ToArray(); BoneStates = boneStates.ToArray(); }
public bool Equals(KeyFrameBoneState other) { return(Scale.Equals(other.Scale) && Rotation.Equals(other.Rotation) && Translation.Equals(other.Translation)); }