From c463bce75418a145d319f214571e30df311ff8df Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 4 Nov 2023 12:14:59 +0000 Subject: Calculate and expose the extents of the terrain mesh --- game/terrain2.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'game/terrain2.h') diff --git a/game/terrain2.h b/game/terrain2.h index 69cd380..eda56d0 100644 --- a/game/terrain2.h +++ b/game/terrain2.h @@ -77,8 +77,17 @@ public: void walk(const PointFace & from, const glm::vec2 to, const std::function & op) const; void walkUntil(const PointFace & from, const glm::vec2 to, const std::function & op) const; + [[nodiscard]] auto + getExtents() const + { + return std::tie(lowerExtent, upperExtent); + } + protected: [[nodiscard]] static bool triangleContainsPoint(const glm::vec2, const glm::vec2, const glm::vec2, const glm::vec2); [[nodiscard]] bool triangleContainsPoint(const glm::vec2, FaceHandle) const; [[nodiscard]] bool triangleContainsPoint(const glm::vec2, ConstFaceVertexIter) const; + +private: + glm::vec3 lowerExtent {}, upperExtent {}; }; -- cgit v1.2.3