diff options
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"); |