summaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-04-08 23:37:17 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2024-04-08 23:37:21 +0100
commitf47aff9a43e5267e5ab42a0111df483129aed6ba (patch)
tree6dfaad3a04eb222dd1960430a023d75349e66189 /game
parentMerge branch 'separate-water' (diff)
downloadilt-f47aff9a43e5267e5ab42a0111df483129aed6ba.tar.bz2
ilt-f47aff9a43e5267e5ab42a0111df483129aed6ba.tar.xz
ilt-f47aff9a43e5267e5ab42a0111df483129aed6ba.zip
Add GeoData face property for surface type
Arbitrary int type for now.
Diffstat (limited to 'game')
-rw-r--r--game/geoData.cpp5
-rw-r--r--game/geoData.h25
2 files changed, 15 insertions, 15 deletions
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 <maths.h>
#include <set>
+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<GeoDataTraits> {
private:
- GeoData() = default;
+ GeoData();
+
+ OpenMesh::FPropHandleT<int> surface;
public:
static GeoData loadFromAsciiGrid(const std::filesystem::path &);
@@ -61,47 +63,41 @@ public:
});
}
- [[nodiscard]]
- glm::vec<Dim, GlobalDistance>
+ [[nodiscard]] glm::vec<Dim, GlobalDistance>
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<glm::length_t D = Dim>
- [[nodiscard]]
- auto
+ [[nodiscard]] auto
angleAt(const GlobalPosition<D> 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);