Fix polysec not generating mesh if body not specified.

This commit is contained in:
2023-04-20 19:40:50 +08:00
parent 69fe03475b
commit b937285a74

View File

@@ -142,7 +142,7 @@ namespace Cryville.Crtr.Components {
uvs = _uvPool.Rent(vc * vcpsec);
int i = 0; int t = 0; float l = 0; int m = 0;
if (head.Frame != null) { m++; GenerateMeshTo(verts, uvs, out trih, head, ref i, ref t, ref l, 0, headLength, vcpsec, hvc); }
if (body.Frame != null) { m++; GenerateMeshTo(verts, uvs, out trib, body, ref i, ref t, ref l, headLength, sumLength - tailLength, vcpsec, hvc + bvc); }
m++; GenerateMeshTo(verts, uvs, out trib, body, ref i, ref t, ref l, headLength, sumLength - tailLength, vcpsec, hvc + bvc);
if (tail.Frame != null) { m++; GenerateMeshTo(verts, uvs, out trit, tail, ref i, ref t, ref l, sumLength - tailLength, sumLength, vcpsec, vc); }
mesh.Mesh.subMeshCount = 3;
@@ -150,7 +150,7 @@ namespace Cryville.Crtr.Components {
mesh.Mesh.SetVertices(verts);
mesh.Mesh.SetUVs(0, uvs);
mesh.Mesh.SetTriangles(head.Frame == null ? _emptyTris : trih, m++);
mesh.Mesh.SetTriangles(body.Frame == null ? _emptyTris : trib, m++);
mesh.Mesh.SetTriangles(trib, m++);
mesh.Mesh.SetTriangles(tail.Frame == null ? _emptyTris : trit, m++);
mesh.Mesh.RecalculateNormals();