summaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
Diffstat (limited to 'game')
-rw-r--r--game/terrain.cpp4
-rw-r--r--game/terrain.h3
2 files changed, 6 insertions, 1 deletions
diff --git a/game/terrain.cpp b/game/terrain.cpp
index bb8e3ce..e7508d0 100644
--- a/game/terrain.cpp
+++ b/game/terrain.cpp
@@ -66,6 +66,10 @@ Terrain::generateMeshes()
void
Terrain::tick(TickDuration)
{
+ if (const auto newGeneration = geoData->getGeneration(); newGeneration != geoGeneration) {
+ generateMeshes();
+ geoGeneration = newGeneration;
+ }
}
void
diff --git a/game/terrain.h b/game/terrain.h
index 7d074cf..c9d09fe 100644
--- a/game/terrain.h
+++ b/game/terrain.h
@@ -27,10 +27,11 @@ public:
RGB colourBias;
};
+private:
void generateMeshes();
-private:
std::shared_ptr<GeoData> geoData;
Collection<MeshT<Vertex>, false> meshes;
Texture::Ptr grass;
+ size_t geoGeneration {};
};