public void SetCurve(Schema2.IAnimationSampler <T> curve) { switch (curve.InterpolationMode) { case Schema2.AnimationInterpolationMode.STEP: case Schema2.AnimationInterpolationMode.LINEAR: { var isLinear = curve.InterpolationMode == Schema2.AnimationInterpolationMode.LINEAR; foreach (var(key, value) in curve.GetLinearKeys()) { this.SetPoint(key, value, isLinear); } break; } case Schema2.AnimationInterpolationMode.CUBICSPLINE: { foreach (var(key, value) in curve.GetCubicKeys()) { this.SetPoint(key, value.Value); this.SetIncomingTangent(key, value.TangentIn); this.SetOutgoingTangent(key, value.TangentOut); } break; } default: throw new NotImplementedException(); } }
public void SetCurve(Schema2.IAnimationSampler <T> curve) { Guard.NotNull(curve, nameof(curve)); switch (curve.InterpolationMode) { case Schema2.AnimationInterpolationMode.STEP: case Schema2.AnimationInterpolationMode.LINEAR: { var isLinear = curve.InterpolationMode == Schema2.AnimationInterpolationMode.LINEAR; foreach (var(key, value) in curve.GetLinearKeys()) { this.SetPoint(key, value, isLinear); } #if DEBUG foreach (var(key, value) in curve.GetLinearKeys()) { var dstKey = _Keys[key]; System.Diagnostics.Debug.Assert(dstKey.Degree <= 1); System.Diagnostics.Debug.Assert(AreEqual(dstKey.Point, value)); } #endif break; } case Schema2.AnimationInterpolationMode.CUBICSPLINE: { foreach (var(key, value) in curve.GetCubicKeys()) { this.SetPoint(key, value.Value); this.SetIncomingTangent(key, value.TangentIn); this.SetOutgoingTangent(key, value.TangentOut); } #if DEBUG foreach (var(key, value) in curve.GetCubicKeys()) { var dstKey = _Keys[key]; System.Diagnostics.Debug.Assert(dstKey.Degree == 3); System.Diagnostics.Debug.Assert(AreEqual(dstKey.Point, value.Value)); System.Diagnostics.Debug.Assert(AreEqual(dstKey.IncomingTangent, value.TangentIn)); System.Diagnostics.Debug.Assert(AreEqual(dstKey.OutgoingTangent, value.TangentOut)); } #endif break; } default: throw new NotImplementedException(); } }