private void SetKeysR( out IJointAnimKey[] Destination, short[] Source, float RotScale, BCA.ANF1Section.AnimatedJoint.AnimComponent.AnimIndex Component) { Destination = new IJointAnimKey[(int)Component.Count]; if (Component.Count <= (ushort)0) { throw new Exception("Count <= 0"); } if (Component.Count == (ushort)1) { Destination[0] = new Key((float)Source[(int)Component.Index] * RotScale); } else { for (int index = 0; index < (int)Component.Count; ++index) { Destination[index] = new Key((float)Source[(int)Component.Index + index] * RotScale); } } }
private void SetKeysR( out IJointAnimKey[] Destination, short[] Source, float RotScale, BCK.ANK1Section.AnimatedJoint.AnimComponent.AnimIndex Component) { Destination = new IJointAnimKey[(int)Component .Count]; if (Component.Count <= (ushort)0) { throw new Exception("Count <= 0"); } if (Component.Count == (ushort)1) { Destination[0] = new BCK.ANK1Section.AnimatedJoint.JointAnim.Key( 0.0f, (float)Source[(int)Component.Index] * RotScale, 0, 0); } else { var tangentMode = Component.TangentMode; var hasTwoTangents = tangentMode == 1; Asserts.True(tangentMode == 0 || tangentMode == 1); var stride = hasTwoTangents ? 4 : 3; for (int index = 0; index < (int)Component.Count; ++index) { var i = (int)Component.Index + stride * index; var time = (float)Source[i + 0]; var value = (float)Source[i + 1] * RotScale; float incomingTangent, outgoingTangent; if (hasTwoTangents) { incomingTangent = Source[i + 2] * RotScale; outgoingTangent = Source[i + 3] * RotScale; } else { incomingTangent = outgoingTangent = Source[i + 2] * RotScale; } Destination[index] = new BCK.ANK1Section.AnimatedJoint.JointAnim.Key( time, value, incomingTangent, outgoingTangent); } } }