summaryrefslogtreecommitdiff
path: root/game/terrain.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2025-03-12 02:59:12 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2025-03-12 02:59:12 +0000
commitf70cbc0dade14cf07cad774ffc8f5c903b1a5ea8 (patch)
tree6dff7eb8ff1deaa4b11697d7b5a27fac8bff3432 /game/terrain.h
parentPerfectly forward range when materializing (diff)
downloadilt-culling.tar.bz2
ilt-culling.tar.xz
ilt-culling.zip
Split Terrain::generateMeshes into smaller functionsculling
Also removes incorrect optimisation that a tile's AABB could be assumed from tile base position; in fact some faces cross the boundaries and the AABB needs to account for this.
Diffstat (limited to 'game/terrain.h')
-rw-r--r--game/terrain.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/game/terrain.h b/game/terrain.h
index eaec01d..1a63296 100644
--- a/game/terrain.h
+++ b/game/terrain.h
@@ -41,9 +41,16 @@ private:
struct SurfaceKey {
const Surface * surface;
GlobalPosition2D basePosition;
- bool operator<(const SurfaceKey &) const;
+ inline bool operator<(const SurfaceKey &) const;
};
+ using SurfaceIndices = std::map<SurfaceKey, std::vector<GLuint>>;
+ void copyVerticesToBuffer() const;
+ [[nodiscard]] SurfaceIndices mapSurfaceFacesToIndices() const;
+ void copyIndicesToBuffers(const SurfaceIndices &);
+ void pruneOrphanMeshes(const SurfaceIndices &);
+ [[nodiscard]] inline GlobalPosition2D getTile(const FaceHandle &) const;
+
glBuffer verticesBuffer;
std::map<SurfaceKey, SurfaceArrayBuffer> meshes;
Texture::Ptr grass = std::make_shared<Texture>("grass.png");