summaryrefslogtreecommitdiff
path: root/game/network/network.h
diff options
context:
space:
mode:
Diffstat (limited to 'game/network/network.h')
-rw-r--r--game/network/network.h10
1 files changed, 10 insertions, 0 deletions
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 <sorting.hpp>
#include <string>
#include <utility>
+#include <variant>
class Texture;
class Shader;
+class Ray;
class Network {
public:
+ using LinkEnd = std::pair<LinkPtr, unsigned char>;
+ using IntersectRayResult = std::variant<std::nullptr_t, NodePtr, LinkEnd, LinkPtr>;
explicit Network(const std::string & textureName);
+ virtual ~Network() = default;
[[nodiscard]] NodePtr findNodeAt(glm::vec3) const;
[[nodiscard]] NodePtr nodeAt(glm::vec3);
[[nodiscard]] std::pair<NodePtr, bool> 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<NodePtr, PtrSorter<NodePtr>>;
Nodes nodes;
@@ -39,6 +46,9 @@ protected:
Collection<T> links;
void joinLinks(const LinkPtr &) const;
+protected:
+ [[nodiscard]] IntersectRayResult intersectRayLinks(const Ray &) const override;
+
public:
template<typename L, typename... Params>
std::shared_ptr<L>