diff --git a/client/Puppet.cs b/client/Puppet.cs
index 9330280..6c2a43a 100644
--- a/client/Puppet.cs
+++ b/client/Puppet.cs
@@ -143,12 +143,7 @@ public partial class Puppet : Node3D
/// Takes up the model's new shape: the carriers that are its bones, their inverse bind, the skin's buffers and the mesh layout.
private void Rebuild()
{
- if (_model.Shape is not { } shape)
- {
- GD.PushError($"BadDay: the puppet has more than {PuppetModel.MaxBones} shape bodies, which is the most it draws; drawing no puppet.");
- _mesh = null; _surface = null; _skin.Mesh = null;
- return;
- }
+ var shape = _model.Shape!;
_boneNodes = new Node3D[shape.Ids.Length]; _inverseBind = new Transform3D[shape.Ids.Length]; _bones = new Rigid[shape.Ids.Length];
for (int i = 0; i < shape.Ids.Length; i++) { _boneNodes[i] = _nodes[shape.Ids[i]]; _inverseBind[i] = ToTransform(shape.SpreadBind[i].Inverse()); }
_surface = new PuppetSkin(shape);
diff --git a/client/PuppetModel.cs b/client/PuppetModel.cs
index 457bd9d..8a99e29 100644
--- a/client/PuppetModel.cs
+++ b/client/PuppetModel.cs
@@ -16,9 +16,6 @@ public readonly record struct PuppetJointLane(Box3DSoaJointKind Kind, ulong A, u
///
public sealed class PuppetModel
{
- /// The most shape bodies the puppet draws; past it nothing is drawn.
- public const int MaxBones = 32;
-
private readonly float _smin, _ballScale, _boxRound;
private readonly Dictionary _bind = new();
private readonly Dictionary<(Box3DSoaJointKind, ulong, ulong), float3> _originLocal = new();
@@ -33,7 +30,7 @@ public sealed class PuppetModel
public PuppetModel(float smin, float ballScale, float boxRound) { _smin = smin; _ballScale = ballScale; _boxRound = boxRound; }
- /// The shape built from the current signature, or null before the first update or while there are more than shape bodies.
+ /// The shape built from the current signature, or null before the first update.
public PuppetShape? Shape { get; private set; }
/// Reads the shape bodies and qualifying joints of the lanes and updates.
@@ -64,7 +61,7 @@ public sealed class PuppetModel
///
/// carry their pose now in ; the model keeps the first one it saw.
- /// Returns whether the signature changed, which is whether the shape was rebuilt (or dropped, past the bone cap).
+ /// Returns whether the signature changed, which is whether the shape was rebuilt.
///
public bool Update(IReadOnlyList bodies, IReadOnlyList joints)
{
@@ -91,7 +88,6 @@ public sealed class PuppetModel
}
_signed = true;
- if (bound.Count > MaxBones) { Shape = null; return true; }
Shape = PuppetField.Build(bound, built, _smin, _ballScale, _boxRound);
return true;
}
diff --git a/client/tests/PuppetChecks.cs b/client/tests/PuppetChecks.cs
index 377dbe7..498e067 100644
--- a/client/tests/PuppetChecks.cs
+++ b/client/tests/PuppetChecks.cs
@@ -70,13 +70,17 @@ public static class PuppetChecks
Changes("a joint's kind changed", (b, j) => j[0] = j[0] with { Kind = Box3DSoaJointKind.Weld });
Changes("a body's identity changed", (b, j) => { b[1] = b[1] with { Id = 21 }; j[0] = j[0] with { B = 21 }; j[1] = j[1] with { A = 21 }; });
- // Past the skin's bone count nothing is drawn, once, and the signature still decides.
+ // Any number of bodies is drawn: a crowd of 40 (no cap, however many the skin has to carry) builds a shape whose every body owns a
+ // vertex, and skins to a surface with a facet for every triangle.
var many = Fresh();
- var crowd = Enumerable.Range(0, PuppetModel.MaxBones + 1).Select(i => Body((ulong)(100 + i), Box3DSoaKind.Sphere, 0.05f, 0f, i * 0.2f)).ToList();
- Check(many.Update(crowd, new List()) && many.Shape is null, "more shape bodies than bones was drawn");
- Check(!many.Update(crowd, new List()), "an over-full puppet reported a change with none");
- crowd.RemoveAt(0);
- Check(many.Update(crowd, new List()) && many.Shape is not null, "the puppet did not come back once it fit the skin");
+ var crowd = Enumerable.Range(0, 40).Select(i => Body((ulong)(100 + i), Box3DSoaKind.Sphere, 0.05f, 0f, i * 0.2f)).ToList();
+ Check(many.Update(crowd, new List()) && many.Shape is { Corners.Length: > 0 }, "a puppet of 40 bodies was not built");
+ var crowdShape = many.Shape!;
+ Check(crowdShape.Ids.Length == 40, $"the crowd's shape carries {crowdShape.Ids.Length} bodies, not 40");
+ Check(!many.Update(crowd, new List()), "a crowd reported a change with none");
+ var crowdSkin = new PuppetSkin(crowdShape);
+ crowdSkin.Update(Enumerable.Repeat(Identity, crowdShape.Ids.Length).ToArray());
+ Check(crowdSkin.Facet.Length * 3 == crowdShape.Corners.Length && crowdSkin.Facet.All(f => math.length(f) > 0.99f), "the crowd's skin has no unit facet for every triangle");
// The real puppet at its creation pose: the grid cell is the coarsest that resolves its limbs, and bent every which way
// no skinned edge is a web.