From d7587defa3cedd6e7ea6d0623aa8cd0f6b27819c Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 2 Oct 2022 18:16:27 +0100 Subject: Add support for searching a network for a ray intersection --- game/network/network.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'game/network/network.h') diff --git a/game/network/network.h b/game/network/network.h index 2ce45f7..64f3f91 100644 --- a/game/network/network.h +++ b/game/network/network.h @@ -9,23 +9,30 @@ #include #include #include +#include class Texture; class Shader; +class Ray; class Network { public: + using LinkEnd = std::pair; + using IntersectRayResult = std::variant; explicit Network(const std::string & textureName); + virtual ~Network() = default; [[nodiscard]] NodePtr findNodeAt(glm::vec3) const; [[nodiscard]] NodePtr nodeAt(glm::vec3); [[nodiscard]] std::pair newNodeAt(glm::vec3); + [[nodiscard]] IntersectRayResult intersectRay(const Ray &) const; [[nodiscard]] Link::Nexts routeFromTo(const Link::End &, glm::vec3) const; [[nodiscard]] Link::Nexts routeFromTo(const Link::End &, const NodePtr &) const; protected: static void joinLinks(const LinkPtr & l, const LinkPtr & ol); + [[nodiscard]] virtual IntersectRayResult intersectRayLinks(const Ray &) const = 0; using Nodes = std::set>; Nodes nodes; @@ -39,6 +46,9 @@ protected: Collection links; void joinLinks(const LinkPtr &) const; +protected: + [[nodiscard]] IntersectRayResult intersectRayLinks(const Ray &) const override; + public: template std::shared_ptr -- cgit v1.2.3