From f9962b0db5072870864a1f758687106139f740dc Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 25 Feb 2025 00:23:11 +0000 Subject: Improve Terrain::generateMeshes performance Creates mesh per surface based on a single buffer of all vertices and a collection of per surfuce indices. Makes ColourBias a uniform instead of a vertex attribute. --- test/perf-terrain.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/perf-terrain.cpp (limited to 'test/perf-terrain.cpp') diff --git a/test/perf-terrain.cpp b/test/perf-terrain.cpp new file mode 100644 index 0000000..dbd44fa --- /dev/null +++ b/test/perf-terrain.cpp @@ -0,0 +1,20 @@ +#include "game/terrain.h" +#include "testMainWindow.h" +#include + +namespace { + void + terrainMeshgen(benchmark::State & state) + { + TestMainWindowAppBase window; + Terrain terrain {GeoData::loadFromAsciiGrid(FIXTURESDIR "height/SD19.asc")}; + + for (auto _ : state) { + terrain.generateMeshes(); + } + } +} + +BENCHMARK(terrainMeshgen); + +BENCHMARK_MAIN(); -- cgit v1.2.3