private static object AddKeys(Track track, TrackNode node1, TrackNode node2) { switch (track.ParamType) { case TrackParamType.Integer: return(node1.GetValue <int>() + node2.GetValue <int>()); case TrackParamType.Color: { var c1 = node1.GetValue <Color4>(); var c2 = node2.GetValue <Color4>(); return(new Color4 { Alpha = c1.Alpha + c2.Alpha, Blue = c1.Blue + c2.Blue, Green = c1.Green + c2.Green, Red = c1.Red + c2.Red }); } case TrackParamType.Vector2: return(node1.GetValue <Vector2>() + node2.GetValue <Vector2>()); case TrackParamType.Vector3: return(node1.GetValue <Vector3>() + node2.GetValue <Vector3>()); case TrackParamType.Quaternion: return(node1.GetValue <Quaternion>() * node2.GetValue <Quaternion>()); default: throw new IndexOutOfRangeException($"Unsupported ParamType for ADD: {track.ParamType}"); } }
private static object LerpKeys(Track track, float t, TrackNode node1, TrackNode node2, TrackNode offset) { switch (track.ParamType) { case TrackParamType.Integer: return(LerpInteger(node1.GetValue <int>(), node2.GetValue <int>(), t, offset.GetValue <int>())); case TrackParamType.Color: return(LerpColor(node1.GetValue <Color4>(), node2.GetValue <Color4>(), t, offset.GetValue <Color4>())); case TrackParamType.Vector2: return(Vector2.Lerp(node1.GetValue <Vector2>(), node2.GetValue <Vector2>(), t) + offset.GetValue <Vector2>()); case TrackParamType.Vector3: return(Vector3.Lerp(node1.GetValue <Vector3>(), node2.GetValue <Vector3>(), t) + offset.GetValue <Vector3>()); case TrackParamType.Quaternion: return(Quaternion.Lerp(node1.GetValue <Quaternion>(), node2.GetValue <Quaternion>(), t) * offset.GetValue <Quaternion>()); default: throw new IndexOutOfRangeException($"Unsupported ParamType for LERP: {track.ParamType}"); } }