Skip to content

Commit 1396ffb

Browse files
committed
demo: Add average group size to printed statistics
This helps ensure that the partitioning splits clusters into a size that is close to our target.
1 parent c8a8302 commit 1396ffb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

demo/nanite.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,8 @@ void nanite(const std::vector<Vertex>& vertices, const std::vector<unsigned int>
576576
while (pending.size() > 1)
577577
{
578578
std::vector<std::vector<int> > groups = partition(clusters, pending, remap);
579+
double avg_group = double(pending.size()) / double(groups.size());
580+
579581
pending.clear();
580582

581583
std::vector<int> retry;
@@ -686,9 +688,9 @@ void nanite(const std::vector<Vertex>& vertices, const std::vector<unsigned int>
686688
double inv_clusters = pending.empty() ? 0 : 1.0 / double(pending.size());
687689

688690
depth++;
689-
printf("lod %d: %d clusters (%.1f%% full, %.1f tri/cl, %.1f vtx/cl, %.2f connected, %.1f boundary), %d triangles",
691+
printf("lod %d: %d clusters (%.1f%% full, %.1f tri/cl, %.1f vtx/cl, %.2f connected, %.1f boundary, %.1f partition), %d triangles",
690692
depth, int(pending.size()),
691-
double(full_clusters) * inv_clusters * 100, double(triangles) * inv_clusters, double(xformed_lod) * inv_clusters, double(components_lod) * inv_clusters, double(boundary_lod) * inv_clusters,
693+
double(full_clusters) * inv_clusters * 100, double(triangles) * inv_clusters, double(xformed_lod) * inv_clusters, double(components_lod) * inv_clusters, double(boundary_lod) * inv_clusters, avg_group,
692694
int(triangles));
693695
if (stuck_clusters)
694696
printf("; stuck %d clusters (%d single, %d triangles)", stuck_clusters, single_clusters, int(stuck_triangles));

0 commit comments

Comments
 (0)