summaryrefslogtreecommitdiff
path: root/test/perf-terrain.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2025-02-25 00:23:11 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2025-02-25 00:23:11 +0000
commitf9962b0db5072870864a1f758687106139f740dc (patch)
treeae1b05395de5c07164151ef7fc7de202be19b9f0 /test/perf-terrain.cpp
parentAdd VertexArrayObject::data for an external existing buffer (diff)
downloadilt-f9962b0db5072870864a1f758687106139f740dc.tar.bz2
ilt-f9962b0db5072870864a1f758687106139f740dc.tar.xz
ilt-f9962b0db5072870864a1f758687106139f740dc.zip
Improve Terrain::generateMeshes performanceHEADmain
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.
Diffstat (limited to 'test/perf-terrain.cpp')
-rw-r--r--test/perf-terrain.cpp20
1 files changed, 20 insertions, 0 deletions
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 <benchmark/benchmark.h>
+
+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();