summaryrefslogtreecommitdiff
path: root/game/geoData.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-12-30 17:18:26 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-12-30 17:18:26 +0000
commit89068c56f3236b65e392cdc8794c5bc1977e5556 (patch)
tree1f500606ea7754dd1a62afee984e88b473c085b2 /game/geoData.h
parentFix naming style of getSurface (diff)
downloadilt-89068c56f3236b65e392cdc8794c5bc1977e5556.tar.bz2
ilt-89068c56f3236b65e392cdc8794c5bc1977e5556.tar.xz
ilt-89068c56f3236b65e392cdc8794c5bc1977e5556.zip
Pass lots more information during GeoData::walk
Diffstat (limited to 'game/geoData.h')
-rw-r--r--game/geoData.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/game/geoData.h b/game/geoData.h
index b3ef22a..68ce9a2 100644
--- a/game/geoData.h
+++ b/game/geoData.h
@@ -64,13 +64,23 @@ public:
[[nodiscard]] IntersectionResult intersectRay(const Ray<GlobalPosition3D> &) const;
[[nodiscard]] IntersectionResult intersectRay(const Ray<GlobalPosition3D> &, FaceHandle start) const;
- void walk(const PointFace & from, const GlobalPosition2D to, const std::function<void(FaceHandle)> & op) const;
- void walkUntil(const PointFace & from, const GlobalPosition2D to, const std::function<bool(FaceHandle)> & op) const;
+ struct WalkStep {
+ FaceHandle current;
+ FaceHandle previous {};
+ HalfedgeHandle exitHalfedge {};
+ GlobalPosition2D exitPosition {};
+ };
+
+ template<typename T> using Consumer = const std::function<void(const T &)> &;
+ template<typename T> using Tester = const std::function<bool(const T &)> &;
+
+ void walk(const PointFace & from, const GlobalPosition2D to, Consumer<WalkStep> op) const;
+ void walkUntil(const PointFace & from, const GlobalPosition2D to, Tester<WalkStep> op) const;
- void boundaryWalk(const std::function<void(HalfedgeHandle)> &) const;
- void boundaryWalk(const std::function<void(HalfedgeHandle)> &, HalfedgeHandle start) const;
- void boundaryWalkUntil(const std::function<bool(HalfedgeHandle)> &) const;
- void boundaryWalkUntil(const std::function<bool(HalfedgeHandle)> &, HalfedgeHandle start) const;
+ void boundaryWalk(Consumer<HalfedgeHandle>) const;
+ void boundaryWalk(Consumer<HalfedgeHandle>, HalfedgeHandle start) const;
+ void boundaryWalkUntil(Tester<HalfedgeHandle>) const;
+ void boundaryWalkUntil(Tester<HalfedgeHandle>, HalfedgeHandle start) const;
[[nodiscard]] HalfedgeHandle findEntry(const GlobalPosition2D from, const GlobalPosition2D to) const;