From b3ed8ebc2099239a3133dca2f0d57c82bd3d6d8b Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Tue, 1 Oct 2024 18:07:28 -0700 Subject: [PATCH] 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. --- demo/nanite.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/demo/nanite.cpp b/demo/nanite.cpp index 45e7ca69..b238195a 100644 --- a/demo/nanite.cpp +++ b/demo/nanite.cpp @@ -567,11 +567,16 @@ void nanite(const std::vector& vertices, const std::vector 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