Skip to content

Commit

Permalink
Fix sub mesh generating having incorrect offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
KillzXGaming committed Sep 6, 2024
1 parent dcdecb1 commit b80383b
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,8 @@ static void CalculateMeshDivision(List<IOVertex> vertices, Shape fshp, Mesh mesh
fshp.SubMeshBoundingNodes.Clear();
fshp.SubMeshBoundings.Clear();

int offset = 0;
foreach (var root in divided)
AddSubMesh(root, ref fshp, ref mesh, ref offset, ref indexList);
AddSubMesh(root, ref fshp, ref mesh, ref indexList);

Console.WriteLine($"fshp {fshp.Name} submeshes {mesh.SubMeshes.Count}");

Expand Down Expand Up @@ -603,9 +602,9 @@ private static void NormalizeByteType(IEnumerable<IOBoneWeight> weights)
}
}

static void AddSubMesh(DivSubMesh subMesh, ref Shape shape, ref Mesh mesh, ref int offset, ref List<uint> indexList)
static void AddSubMesh(DivSubMesh subMesh, ref Shape shape, ref Mesh mesh, ref List<uint> indexList)
{
offset += indexList.Count;
var offset = indexList.Count;
indexList.AddRange(subMesh.Faces.Select(x => (uint)x).ToList());

int index = mesh.SubMeshes.Count;
Expand Down

0 comments on commit b80383b

Please sign in to comment.