Skip to content

Commit

Permalink
test: blendShape with frame at zero
Browse files Browse the repository at this point in the history
  • Loading branch information
anatawa12 committed Nov 3, 2023
1 parent 75397bd commit d3453b9
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Test~/MeshInfo2/MeshInfo2Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,30 @@ public void MultiFrameBlendShapeWithPartiallyIdentity()
}
}

[Test]
public void BlendShapeWithFrameAtZero()
{
var mesh = BoxMesh();
var deltas = new Vector3[8];
deltas.AsSpan().Fill(new Vector3(1, 2, 3));
mesh.AddBlendShapeFrame("shape", 0, deltas, null, null);
mesh.AddBlendShapeFrame("shape", 1, deltas, null, null);

var go = new GameObject();
var smr = go.AddComponent<SkinnedMeshRenderer>();
smr.sharedMesh = mesh;

var meshInfo2 = new MeshInfo2(smr);

Vector3 position;
var vertex = meshInfo2.Vertices[0];
Assert.That(vertex.TryGetBlendShape("shape", 0, out position, out _, out _), Is.True);
Assert.That(position, Is.EqualTo(new Vector3(0, 0, 0)));

Assert.That(vertex.TryGetBlendShape("shape", 0, out position, out _, out _, getDefined: true), Is.True);
Assert.That(position, Is.EqualTo(new Vector3(1, 2, 3)));
}

private Mesh BoxMesh()
{
var mesh = new Mesh
Expand Down

0 comments on commit d3453b9

Please sign in to comment.