From 917c081ddc1651381f83d8a9b0e095440419814a Mon Sep 17 00:00:00 2001
From: Dan Goodliffe <dan@randomdan.homeip.net>
Date: Sun, 5 Jan 2025 01:09:01 +0000
Subject: Helper to declare and add OpenMesh property declaratively

---
 game/geoData.cpp | 5 -----
 game/geoData.h   | 5 ++---
 2 files changed, 2 insertions(+), 8 deletions(-)

(limited to 'game')

diff --git a/game/geoData.cpp b/game/geoData.cpp
index f0e38d0..950fb73 100644
--- a/game/geoData.cpp
+++ b/game/geoData.cpp
@@ -7,11 +7,6 @@
 #include <ranges>
 #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 e3fc313..11ba568 100644
--- a/game/geoData.h
+++ b/game/geoData.h
@@ -10,6 +10,7 @@
 #include <glm/vec2.hpp>
 #include <optional>
 #include <thirdparty/openmesh/glmcompat.h>
+#include <thirdparty/openmesh/helpers.h>
 
 struct GeoDataTraits : public OpenMesh::DefaultTraits {
 	FaceAttributes(OpenMesh::Attributes::Status);
@@ -22,9 +23,7 @@ struct GeoDataTraits : public OpenMesh::DefaultTraits {
 
 class GeoData : public OpenMesh::TriMesh_ArrayKernelT<GeoDataTraits> {
 private:
-	GeoData();
-
-	OpenMesh::FPropHandleT<const Surface *> surface;
+	const OpenMesh::Helpers::Property<const Surface *, OpenMesh::FPropHandleT> surface {this};
 
 public:
 	static GeoData loadFromAsciiGrid(const std::filesystem::path &);
-- 
cgit v1.2.3