demo: Add total triangle/cluster counter

This is helpful to estimate the memory impact of the full LOD chain and
makes it easier to compare stats with UE which reports them in log file.
This commit is contained in:
Arseny Kapoulkine
2024-10-01 18:07:28 -07:00
parent c5b712f236
commit b3ed8ebc20
+5
View File
@@ -567,11 +567,16 @@ void nanite(const std::vector<Vertex>& vertices, const std::vector<unsigned int>
pending.insert(pending.end(), retry.begin(), retry.end());
}
size_t total_triangles = 0;
size_t lowest_triangles = 0;
for (size_t i = 0; i < clusters.size(); ++i)
{
total_triangles += clusters[i].indices.size() / 3;
if (clusters[i].parent.error == FLT_MAX)
lowest_triangles += clusters[i].indices.size() / 3;
}
printf("total: %d triangles in %d clusters\n", int(total_triangles), int(clusters.size()));
printf("lowest lod: %d triangles\n", int(lowest_triangles));
// for testing purposes, we can compute a DAG cut from a given viewpoint and dump it as an OBJ