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

MeltyPlayer / MeltyTool / 20982513833

14 Jan 2026 04:35AM UTC coverage: 41.138% (-0.8%) from 41.907%
20982513833

push

github

MeltyPlayer
Fixed broken shader source tests.

6752 of 18485 branches covered (36.53%)

Branch coverage included in aggregate %.

28650 of 67572 relevant lines covered (42.4%)

64006.02 hits per line

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

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

6
using fin.animation.interpolation;
7
using fin.animation.keyframes;
8
using fin.math.interpolation;
9
using fin.util.asserts;
10

11
using NoAlloq;
12

13
namespace fin.animation.types.vector3;
14

15
public sealed class SeparateVector3Keyframes<TKeyframe>(
19,695✔
16
    ISharedInterpolationConfig sharedConfig,
19,695✔
17
    IKeyframeInterpolator<TKeyframe, float> interpolator,
19,695✔
18
    IndividualInterpolationConfig<float>? individualConfigX,
19,695✔
19
    IndividualInterpolationConfig<float>? individualConfigY,
19,695✔
20
    IndividualInterpolationConfig<float>? individualConfigZ)
19,695✔
21
    : ISeparateVector3Keyframes<TKeyframe>
22
    where TKeyframe : IKeyframe<float> {
23
  public SeparateVector3Keyframes(
24
      ISharedInterpolationConfig sharedConfig,
25
      IKeyframeInterpolator<TKeyframe, float> interpolator,
26
      IndividualInterpolationConfig<float>? individualConfig = null)
27
      : this(sharedConfig,
2✔
28
             interpolator,
2✔
29
             individualConfig,
2✔
30
             individualConfig,
2✔
31
             individualConfig) { }
6✔
32

33
  public int AnimationLength => sharedConfig.AnimationLength;
×
34
  public bool Looping => sharedConfig.Looping;
×
35

36
  public IReadOnlyList<IInterpolatableKeyframes<TKeyframe, float>> Axes { get; }
501,648✔
37
    = [
19,695✔
38
        new InterpolatedKeyframes<TKeyframe, float>(
19,695✔
39
            sharedConfig,
19,695✔
40
            interpolator,
19,695✔
41
            individualConfigX),
19,695✔
42
        new InterpolatedKeyframes<TKeyframe, float>(
19,695✔
43
            sharedConfig,
19,695✔
44
            interpolator,
19,695✔
45
            individualConfigY),
19,695✔
46
        new InterpolatedKeyframes<TKeyframe, float>(
19,695✔
47
            sharedConfig,
19,695✔
48
            interpolator,
19,695✔
49
            individualConfigZ),
19,695✔
50
    ];
19,695✔
51

52
  public bool TryGetAtFrame(float frame, out Vector3 value) {
20✔
53
    value = default;
20✔
54

55
    if (!this.Axes[0]
20!
56
             .TryGetAtFrameOrDefault(frame, individualConfigX, out var x)) {
20✔
57
      return false;
×
58
    }
59

60
    if (!this.Axes[1]
20!
61
             .TryGetAtFrameOrDefault(frame, individualConfigY, out var y)) {
20✔
62
      return false;
×
63
    }
64

65
    if (!this.Axes[2]
20!
66
             .TryGetAtFrameOrDefault(frame, individualConfigZ, out var z)) {
20✔
67
      return false;
×
68
    }
69

70
    value = new Vector3(x, y, z);
20✔
71
    return true;
20✔
72
  }
20✔
73

74
  public void GetAllFrames(Span<Vector3> dst) {
11,980✔
75
    Span<float> x = stackalloc float[dst.Length];
11,980✔
76
    Span<float> y = stackalloc float[dst.Length];
11,980✔
77
    Span<float> z = stackalloc float[dst.Length];
11,980✔
78

79
    this.Axes[0].GetAllFrames(x);
11,980✔
80
    this.Axes[1].GetAllFrames(y);
11,980✔
81
    this.Axes[2].GetAllFrames(z);
11,980✔
82

83
    for (var i = 0; i < dst.Length; ++i) {
1,967,531✔
84
      dst[i] = new Vector3(x[i], y[i], z[i]);
647,857✔
85
    }
647,857✔
86
  }
11,980✔
87

88
  public bool TryGetSimpleKeyframes(
89
      out IReadOnlyList<(float frame, Vector3 value)> keyframes,
90
      out IReadOnlyList<(Vector3 tangentIn, Vector3 tangentOut)>?
91
          tangentKeyframes) {
17,065✔
92
    var xAxis = this.Axes[0];
17,065✔
93
    var yAxis = this.Axes[1];
17,065✔
94
    var zAxis = this.Axes[2];
17,065✔
95

96
    if (!xAxis.HasAnyData && !yAxis.HasAnyData && !zAxis.HasAnyData) {
17,065!
97
      keyframes = [];
×
98
      tangentKeyframes = null;
×
99
      return true;
×
100
    }
101

102
    Span<(IInterpolatableKeyframes<TKeyframe, float> keyframes,
17,065✔
103
        IInterpolatableKeyframes<KeyframeWithTangents<float>, float>? keyframesWithTangents,
17,065✔
104
        IndividualInterpolationConfig<float>? config)> axes = [
17,065✔
105
        (xAxis,
17,065✔
106
         xAxis as IInterpolatableKeyframes<KeyframeWithTangents<float>, float>,
17,065✔
107
         individualConfigX),
17,065✔
108
        (yAxis,
17,065✔
109
         yAxis as IInterpolatableKeyframes<KeyframeWithTangents<float>, float>,
17,065✔
110
         individualConfigY),
17,065✔
111
        (zAxis,
17,065✔
112
         zAxis as IInterpolatableKeyframes<KeyframeWithTangents<float>, float>,
17,065✔
113
         individualConfigZ),
17,065✔
114
    ];
17,065✔
115

116
    if (axes.Any(a => !a.keyframes.HasAnyData &&
68,260!
117
                      !(a.config?.DefaultValue?.Try(out _) ?? false))) {
68,260✔
118
      keyframes = null!;
×
119
      tangentKeyframes = null;
×
120
      return false;
×
121
    }
122

123
    var unionKeyframes
17,065✔
124
        = xAxis.Definitions
17,065✔
125
               .Concat(yAxis.Definitions)
17,065✔
126
               .Concat(zAxis.Definitions)
17,065✔
127
               .Select(keyframe => keyframe.Frame)
360,003✔
128
               .Distinct()
17,065✔
129
               .Order()
17,065✔
130
               .ToArray();
17,065✔
131

132
    var unionKeyframeCount = unionKeyframes.Length;
17,065✔
133

134
    {
17,065✔
135
      var mutableKeyframes = new (float, Vector3)[unionKeyframeCount];
17,065✔
136
      for (var k = 0; k < unionKeyframeCount; ++k) {
485,510✔
137
        var keyframe = unionKeyframes[k];
150,460✔
138
        var value = new Vector3();
150,460✔
139

140
        for (var i = 0; i < axes.Length; ++i) {
1,655,060✔
141
          var axis = axes[i];
451,380✔
142
          Asserts.True(
451,380✔
143
              axis.keyframes.TryGetAtFrameOrDefault(keyframe,
451,380✔
144
                                                    axis.config,
451,380✔
145
                                                    out var axisValue));
451,380✔
146
          value[i] = axisValue;
451,380✔
147
        }
451,380✔
148

149
        mutableKeyframes[k] = (keyframe, value);
150,460✔
150
      }
150,460✔
151

152
      keyframes = mutableKeyframes;
17,065✔
153
    }
17,065✔
154

155
    if (axes.Any(a => a.keyframesWithTangents == null)) {
66,282✔
156
      tangentKeyframes = null;
1,978✔
157
    } else {
17,065✔
158
      var mutableTangentKeyframes = new (Vector3, Vector3)[unionKeyframeCount];
15,087✔
159

160
      for (var k = 0; k < unionKeyframeCount; ++k) {
297,062✔
161
        var keyframe = unionKeyframes[k];
96,948✔
162

163
        var tangentIn = new Vector3();
96,948✔
164
        var tangentOut = new Vector3();
96,948✔
165

166
        for (var i = 0; i < axes.Length; ++i) {
976,079✔
167
          var axis = axes[i];
268,713✔
168
          if (!HermiteInterpolationUtil.TryGetTangent(
268,713✔
169
                  axis.keyframesWithTangents!,
268,713✔
170
                  keyframe,
268,713✔
171
                  out var axisTangentIn,
268,713✔
172
                  out var axisTangentOut)) {
280,691✔
173
            tangentKeyframes = null;
11,978✔
174
            return false;
11,978✔
175
          }
176

177
          tangentIn[i] = axisTangentIn;
256,735✔
178
          tangentOut[i] = axisTangentOut;
256,735✔
179
        }
256,735✔
180

181
        mutableTangentKeyframes[k] = (tangentIn, tangentOut);
84,970✔
182
      }
84,970✔
183

184
      tangentKeyframes = mutableTangentKeyframes;
3,109✔
185
    }
3,109✔
186

187
    return true;
5,087✔
188
  }
17,065✔
189
}
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