diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-03-13 20:42:33 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-03-13 20:42:33 +0000 |
commit | b9771cbeb80e5b540587a01be145154612bbc83d (patch) | |
tree | 6dff7eb8ff1deaa4b11697d7b5a27fac8bff3432 /game/terrain.h | |
parent | Split core view definition out of Camera into Frustum (diff) | |
parent | Split Terrain::generateMeshes into smaller functions (diff) | |
download | ilt-b9771cbeb80e5b540587a01be145154612bbc83d.tar.bz2 ilt-b9771cbeb80e5b540587a01be145154612bbc83d.tar.xz ilt-b9771cbeb80e5b540587a01be145154612bbc83d.zip |
Merge branch 'culling'
Diffstat (limited to 'game/terrain.h')
-rw-r--r-- | game/terrain.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/game/terrain.h b/game/terrain.h index f5b1b32..1a63296 100644 --- a/game/terrain.h +++ b/game/terrain.h @@ -16,8 +16,8 @@ public: generateMeshes(); } - void render(const SceneShader & shader) const override; - void shadows(const ShadowMapper &) const override; + void render(const SceneShader & shader, const Frustum &) const override; + void shadows(const ShadowMapper &, const Frustum &) const override; void tick(TickDuration) override; @@ -35,14 +35,22 @@ private: glVertexArray vertexArray; glBuffer indicesBuffer; GLsizei count; + AxisAlignedBoundingBox<GlobalDistance> aabb; }; 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"); |