From f47aff9a43e5267e5ab42a0111df483129aed6ba Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 8 Apr 2024 23:37:17 +0100 Subject: Add GeoData face property for surface type Arbitrary int type for now. --- game/geoData.cpp | 5 +++++ game/geoData.h | 25 ++++++++++--------------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'game') diff --git a/game/geoData.cpp b/game/geoData.cpp index 2313342..e465ba0 100644 --- a/game/geoData.cpp +++ b/game/geoData.cpp @@ -6,6 +6,11 @@ #include #include +GeoData::GeoData() +{ + add_property(surface); +} + GeoData GeoData::loadFromAsciiGrid(const std::filesystem::path & input) { diff --git a/game/geoData.h b/game/geoData.h index 021b4c7..e3e9bcb 100644 --- a/game/geoData.h +++ b/game/geoData.h @@ -20,7 +20,9 @@ struct GeoDataTraits : public OpenMesh::DefaultTraits { class GeoData : public OpenMesh::TriMesh_ArrayKernelT { private: - GeoData() = default; + GeoData(); + + OpenMesh::FPropHandleT surface; public: static GeoData loadFromAsciiGrid(const std::filesystem::path &); @@ -61,47 +63,41 @@ public: }); } - [[nodiscard]] - glm::vec + [[nodiscard]] glm::vec operator*(BaryPosition bari) const { return p(0) + (difference(p(0), p(1)) * bari.x) + (difference(p(0), p(2)) * bari.y); } - [[nodiscard]] - auto + [[nodiscard]] auto area() const requires(Dim == 3) { return glm::length(crossProduct(difference(p(0), p(1)), difference(p(0), p(2)))) / 2.F; } - [[nodiscard]] - Normal3D + [[nodiscard]] Normal3D normal() const requires(Dim == 3) { return crossProduct(difference(p(0), p(1)), difference(p(0), p(2))); } - [[nodiscard]] - Normal3D + [[nodiscard]] Normal3D nnormal() const requires(Dim == 3) { return glm::normalize(normal()); } - [[nodiscard]] - auto + [[nodiscard]] auto angle(glm::length_t c) const { return Arc {P(c), P(c + 2), P(c + 1)}.length(); } template - [[nodiscard]] - auto + [[nodiscard]] auto angleAt(const GlobalPosition pos) const requires(D <= Dim) { @@ -113,8 +109,7 @@ public: return 0.F; } - [[nodiscard]] - inline auto + [[nodiscard]] inline auto p(const glm::length_t i) const { return base::operator[](i); -- cgit v1.2.3