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

MeltyPlayer / MeltyTool / 20015782297

08 Dec 2025 03:31AM UTC coverage: 41.907% (+0.001%) from 41.906%
20015782297

push

github

MeltyPlayer
Oops, meant to include this in the last commit.

6751 of 18177 branches covered (37.14%)

Branch coverage included in aggregate %.

28648 of 66293 relevant lines covered (43.21%)

65238.82 hits per line

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

95.7
/FinModelUtility/Fin/Fin/src/model/impl/SkeletonImpl.cs
1
using System.Collections;
2
using System.Collections.Generic;
3
using System.Collections.ObjectModel;
4
using System.Numerics;
5

6
using fin.data;
7
using fin.math.transform;
8

9
namespace fin.model.impl;
10

11
public partial class ModelImpl<TVertex> {
12
  public ISkeleton Skeleton { get; } = new SkeletonImpl();
2,090✔
13

14
  private class SkeletonImpl : ISkeleton {
15
    public readonly List<IBone> bones = [];
112✔
16

17
    public IBone Root { get; }
31,687✔
18
    public IReadOnlyList<IBone> Bones => this.bones;
156✔
19

20
    public SkeletonImpl() {
224✔
21
      this.Root = new BoneImpl(this, null, 0, 0, 0);
112✔
22
    }
112✔
23

24
    private class BoneImpl : IBone {
25
      private readonly SkeletonImpl skeleton_;
26
      private readonly IList<IBone> children_ = new List<IBone>();
4,047✔
27
      private readonly Counter counter_;
28

29
      public BoneImpl(SkeletonImpl skeletonImpl,
119✔
30
                      IBone? parent,
119✔
31
                      float x,
119✔
32
                      float y,
119✔
33
                      float z) {
238✔
34
        this.skeleton_ = skeletonImpl;
119✔
35
        this.Root = this;
119✔
36
        this.Parent = parent;
119✔
37

38
        this.LocalTransform
119✔
39
            = new Transform3d(parent?.LocalTransform as Transform3d);
119✔
40
        this.LocalTransform.SetTranslation(x, y, z);
119✔
41

42
        this.skeleton_.bones.Add(this);
119✔
43

44
        this.Children = new ReadOnlyCollection<IBone>(this.children_);
119✔
45

46
        this.counter_ = (parent as BoneImpl)?.counter_ ?? new Counter();
119✔
47
        this.Index = this.counter_.GetAndIncrement();
119✔
48
      }
119✔
49

50
      public BoneImpl(SkeletonImpl skeletonImpl,
3,928✔
51
                      IBone root,
3,928✔
52
                      IBone? parent,
3,928✔
53
                      float x,
3,928✔
54
                      float y,
3,928✔
55
                      float z) {
7,856✔
56
        this.skeleton_ = skeletonImpl;
3,928✔
57
        this.Root = root;
3,928✔
58
        this.Parent = parent;
3,928✔
59

60
        this.LocalTransform
3,928!
61
            = new Transform3d(parent?.LocalTransform as Transform3d);
3,928✔
62
        this.LocalTransform.SetTranslation(x, y, z);
3,928✔
63

64
        this.skeleton_.bones.Add(this);
3,928✔
65

66
        this.Children = new ReadOnlyCollection<IBone>(this.children_);
3,928✔
67

68
        this.counter_ = (parent as BoneImpl ?? root as BoneImpl)!.counter_;
3,928!
69
        this.Index = this.counter_.GetAndIncrement();
3,928✔
70
      }
3,928✔
71

72
      public string Name { get; set; }
12,580✔
73
      public int Index { get; set; }
806,208✔
74

75
      public override string ToString() => $"{this.Name} <{this.Index}>";
×
76

77
      public IBone Root { get; }
3,928✔
78
      public IBone? Parent { get; }
176✔
79
      public IReadOnlyList<IBone> Children { get; }
142,474✔
80

81

82
      public IBone AddRoot(float x, float y, float z) {
7✔
83
        var child = new BoneImpl(this.skeleton_, this, x, y, z);
7✔
84
        this.children_.Add(child);
7✔
85
        return child;
7✔
86
      }
7✔
87

88
      public IBone AddChild(float x, float y, float z) {
3,928✔
89
        var child = new BoneImpl(this.skeleton_, this.Root, this, x, y, z);
3,928✔
90
        this.children_.Add(child);
3,928✔
91
        return child;
3,928✔
92
      }
3,928✔
93

94
      public ITransform3d LocalTransform { get; }
4,044,662✔
95
      public bool IgnoreParentScale { get; set; }
4,636✔
96

97
      public IBone AlwaysFaceTowardsCamera(
98
          FaceTowardsCameraType faceTowardsCameraType)
99
        => this.AlwaysFaceTowardsCamera(faceTowardsCameraType, Quaternion.Identity);
5✔
100
      public IBone AlwaysFaceTowardsCamera(
101
          FaceTowardsCameraType faceTowardsCameraType,
102
          in Quaternion adjustment) {
5✔
103
        this.FaceTowardsCameraType = faceTowardsCameraType;
5✔
104
        this.FaceTowardsCameraAdjustment = adjustment;
5✔
105
        return this;
5✔
106
      }
5✔
107

108
      public FaceTowardsCameraType FaceTowardsCameraType { get; private set; }
3,896✔
109
      public Quaternion FaceTowardsCameraAdjustment { get; private set; }
5✔
110
    }
111

112
    IEnumerator IEnumerable.GetEnumerator() => this.GetEnumerator();
×
113

114
    public IEnumerator<IReadOnlyBone> GetEnumerator() {
1,664✔
115
      var queue = new Queue<IReadOnlyBone>();
1,664✔
116
      queue.Enqueue(this.Root);
1,664✔
117
      while (queue.Count > 0) {
270,298✔
118
        var bone = queue.Dequeue();
134,317✔
119
        yield return bone;
134,317✔
120

121
        foreach (var child in bone.Children) {
800,910✔
122
          queue.Enqueue(child);
132,653✔
123
        }
132,653✔
124
      }
134,317✔
125
    }
1,664✔
126
  }
127
}
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