• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MeltyPlayer / MeltyTool / 17724702310

15 Sep 2025 06:57AM UTC coverage: 40.127% (+0.1%) from 40.029%
17724702310

push

github

MeltyPlayer
Supported writing out separate vector 3 keyframe tracks as keyframes as long as it's effectively a combined track.

5826 of 16419 branches covered (35.48%)

Branch coverage included in aggregate %.

73 of 74 new or added lines in 2 files covered. (98.65%)

3 existing lines in 1 file now uncovered.

24549 of 59279 relevant lines covered (41.41%)

72245.15 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.03
/FinModelUtility/Fin/Fin/src/animation/types/vector3/SeparateVector3Keyframes.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Numerics;
4

5
using fin.animation.interpolation;
6
using fin.animation.keyframes;
7
using fin.math.floats;
8

9
namespace fin.animation.types.vector3;
10

11
public class SeparateVector3Keyframes<TKeyframe>(
19,695✔
12
    ISharedInterpolationConfig sharedConfig,
19,695✔
13
    IKeyframeInterpolator<TKeyframe, float> interpolator,
19,695✔
14
    IndividualInterpolationConfig<float> individualConfigX,
19,695✔
15
    IndividualInterpolationConfig<float> individualConfigY,
19,695✔
16
    IndividualInterpolationConfig<float> individualConfigZ)
19,695✔
17
    : ISeparateVector3Keyframes<TKeyframe>
18
    where TKeyframe : IKeyframe<float> {
19
  public SeparateVector3Keyframes(
20
      ISharedInterpolationConfig sharedConfig,
21
      IKeyframeInterpolator<TKeyframe, float> interpolator,
22
      IndividualInterpolationConfig<float> individualConfig = default)
23
      : this(sharedConfig,
2✔
24
             interpolator,
2✔
25
             individualConfig,
2✔
26
             individualConfig,
2✔
27
             individualConfig) { }
6✔
28

29
  public IReadOnlyList<IInterpolatableKeyframes<TKeyframe, float>> Axes { get; }
484,368✔
30
    = [
19,695✔
31
        new InterpolatedKeyframes<TKeyframe, float>(
19,695✔
32
            sharedConfig,
19,695✔
33
            interpolator,
19,695✔
34
            individualConfigX),
19,695✔
35
        new InterpolatedKeyframes<TKeyframe, float>(
19,695✔
36
            sharedConfig,
19,695✔
37
            interpolator,
19,695✔
38
            individualConfigY),
19,695✔
39
        new InterpolatedKeyframes<TKeyframe, float>(
19,695✔
40
            sharedConfig,
19,695✔
41
            interpolator,
19,695✔
42
            individualConfigZ),
19,695✔
43
    ];
19,695✔
44

45
  public bool TryGetAtFrame(float frame, out Vector3 value) {
20✔
46
    value = default;
20✔
47

48
    if (!this.Axes[0]
20!
49
             .TryGetAtFrameOrDefault(frame, individualConfigX, out var x)) {
20✔
UNCOV
50
      return false;
×
51
    }
52

53
    if (!this.Axes[1]
20!
54
             .TryGetAtFrameOrDefault(frame, individualConfigY, out var y)) {
20✔
UNCOV
55
      return false;
×
56
    }
57

58
    if (!this.Axes[2]
20!
59
             .TryGetAtFrameOrDefault(frame, individualConfigZ, out var z)) {
20✔
UNCOV
60
      return false;
×
61
    }
62

63
    value = new Vector3(x, y, z);
20✔
64
    return true;
20✔
65
  }
20✔
66

67
  public void GetAllFrames(Span<Vector3> dst) {
6,220✔
68
    Span<float> x = stackalloc float[dst.Length];
6,220✔
69
    Span<float> y = stackalloc float[dst.Length];
6,220✔
70
    Span<float> z = stackalloc float[dst.Length];
6,220✔
71

72
    this.Axes[0].GetAllFrames(x);
6,220✔
73
    this.Axes[1].GetAllFrames(y);
6,220✔
74
    this.Axes[2].GetAllFrames(z);
6,220✔
75

76
    for (var i = 0; i < dst.Length; ++i) {
845,402✔
77
      dst[i] = new Vector3(x[i], y[i], z[i]);
277,654✔
78
    }
277,654✔
79
  }
6,220✔
80

81
  // TODO: Implement this
82
  public bool TryGetSimpleKeyframes(
83
      out IReadOnlyList<(float frame, Vector3 value)> keyframes,
84
      out IReadOnlyList<(Vector3 tangentIn, Vector3 tangentOut)>?
85
          tangentKeyframes) {
17,065✔
86
    var xAxis = this.Axes[0];
17,065✔
87
    var yAxis = this.Axes[1];
17,065✔
88
    var zAxis = this.Axes[2];
17,065✔
89

90
    if (!xAxis.HasAnyData || !yAxis.HasAnyData || !zAxis.HasAnyData) {
22,180✔
91
      keyframes = default;
5,115✔
92
      tangentKeyframes = null;
5,115✔
93
      return false;
5,115✔
94
    }
95

96
    var xDefinitions = xAxis.Definitions;
11,950✔
97
    var yDefinitions = yAxis.Definitions;
11,950✔
98
    var zDefinitions = zAxis.Definitions;
11,950✔
99
    if (xDefinitions.Count != yDefinitions.Count ||
11,950✔
100
        xDefinitions.Count != zDefinitions.Count) {
13,013✔
101
      keyframes = default;
1,063✔
102
      tangentKeyframes = null;
1,063✔
103
      return false;
1,063✔
104
    }
105

106
    var length = xDefinitions.Count;
10,887✔
107
    for (var i = 0; i < length; ++i) {
280,393✔
108
      if (!xDefinitions[i].Frame.IsRoughly(yDefinitions[i].Frame) ||
86,233✔
109
          !xDefinitions[i].Frame.IsRoughly(zDefinitions[i].Frame)) {
86,273✔
110
        keyframes = default;
40✔
111
        tangentKeyframes = null;
40✔
112
        return false;
40✔
113
      }
114
    }
86,193✔
115

116
    if (xDefinitions
10,847✔
117
            is IReadOnlyList<KeyframeWithTangents<float>> xTangentDefinitions &&
10,847✔
118
        yDefinitions
10,847✔
119
            is IReadOnlyList<KeyframeWithTangents<float>> yTangentDefinitions &&
10,847✔
120
        zDefinitions
10,847✔
121
            is IReadOnlyList<KeyframeWithTangents<float>> zTangentDefinitions) {
19,784✔
122
      var mutableKeyframes = new (float, Vector3)[length];
8,937✔
123
      var mutableTangentKeyframes = new (Vector3, Vector3)[length];
8,937✔
124
      for (var i = 0; i < length; ++i) {
262,131✔
125
        var xKeyframe = xTangentDefinitions[i];
81,419✔
126
        var yKeyframe = yTangentDefinitions[i];
81,419✔
127
        var zKeyframe = zTangentDefinitions[i];
81,419✔
128

129
        mutableKeyframes[i] = (xKeyframe.Frame,
81,419✔
130
                               new Vector3(xKeyframe.ValueOut,
81,419✔
131
                                           yKeyframe.ValueOut,
81,419✔
132
                                           zKeyframe.ValueOut));
81,419✔
133
        mutableTangentKeyframes[i]
81,419✔
134
            = (new Vector3(xKeyframe.TangentIn ?? 0,
81,419✔
135
                           yKeyframe.TangentIn ?? 0,
81,419✔
136
                           zKeyframe.TangentIn ?? 0),
81,419✔
137
               new Vector3(xKeyframe.TangentOut ?? 0,
81,419✔
138
                           yKeyframe.TangentOut ?? 0,
81,419✔
139
                           zKeyframe.TangentOut ?? 0));
81,419✔
140
      }
81,419✔
141

142
      keyframes = mutableKeyframes;
8,937✔
143
      tangentKeyframes = mutableTangentKeyframes;
8,937✔
144
      return true;
8,937✔
145
    } else {
1,910✔
146
      var mutableKeyframes = new (float, Vector3)[length];
1,910✔
147
      for (var i = 0; i < length; ++i) {
17,773✔
148
        var xKeyframe = xDefinitions[i];
4,651✔
149
        var yKeyframe = yDefinitions[i];
4,651✔
150
        var zKeyframe = zDefinitions[i];
4,651✔
151

152
        mutableKeyframes[i] = (xKeyframe.Frame,
4,651✔
153
                               new Vector3(xKeyframe.ValueOut,
4,651✔
154
                                           yKeyframe.ValueOut,
4,651✔
155
                                           zKeyframe.ValueOut));
4,651✔
156
      }
4,651✔
157

158
      keyframes = mutableKeyframes;
1,910✔
159
      tangentKeyframes = null;
1,910✔
160
      return true;
1,910✔
161
    }
162
  }
17,065✔
163
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc