Add tri count per LoD to models tab

Adds the tri count of each LoD on the selected model to the Models tab under
Advanced Editing.
This commit is contained in:
AeAstralis 2024-03-20 22:33:35 -04:00
parent 384b8fd489
commit 0ad769e08e
No known key found for this signature in database

View file

@ -508,6 +508,11 @@ public partial class ModEditWindow
ImGuiUtil.DrawTableColumn(file.VertexDeclarations.Length.ToString());
ImGuiUtil.DrawTableColumn("Stack Size");
ImGuiUtil.DrawTableColumn(file.StackSize.ToString());
for (var lod = 0; lod < file.Lods.Length; lod++)
{
ImGuiUtil.DrawTableColumn("LoD " + lod + " Triangle Count");
ImGuiUtil.DrawTableColumn(GetTriangleCountForLod(file, lod).ToString());
}
}
}
@ -555,6 +560,18 @@ public partial class ModEditWindow
return file != null;
}
private static long GetTriangleCountForLod(MdlFile model, int lod)
{
var vertSum = 0u;
var meshIndex = model.Lods[lod].MeshIndex;
var meshCount = model.Lods[lod].MeshCount;
for (var i = meshIndex; i < meshIndex + meshCount; i++)
vertSum += model.Meshes[i].IndexCount;
return vertSum / 3;
}
private static readonly string[] ValidModelExtensions =
[
".gltf",