From d11d99323d642ebb1cf84302b2b25019e95b5607 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 15 Oct 2022 15:30:44 +0100 Subject: Add free extend builder with placeholder network support --- game/network/network.h | 10 ++++++++-- game/network/network.impl.h | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'game/network') diff --git a/game/network/network.h b/game/network/network.h index 773426e..b95dfdc 100644 --- a/game/network/network.h +++ b/game/network/network.h @@ -33,8 +33,10 @@ public: virtual Link::CCollection candidateStraight(glm::vec3, glm::vec3) = 0; virtual Link::CCollection candidateJoins(glm::vec3, glm::vec3) = 0; + virtual Link::CCollection candidateExtend(glm::vec3, glm::vec3) = 0; virtual Link::CCollection addStraight(glm::vec3, glm::vec3) = 0; virtual Link::CCollection addJoins(glm::vec3, glm::vec3) = 0; + virtual Link::CCollection addExtend(glm::vec3, glm::vec3) = 0; protected: static void joinLinks(const Link::Ptr & l, const Link::Ptr & ol); @@ -57,7 +59,8 @@ protected: public: template std::shared_ptr - candidateLink(glm::vec3 a, glm::vec3 b, Params &&... params) requires std::is_base_of_v + candidateLink(glm::vec3 a, glm::vec3 b, Params &&... params) + requires std::is_base_of_v { const auto node1 = candidateNodeAt(a).first, node2 = candidateNodeAt(b).first; return std::make_shared(node1, node2, std::forward(params)...); @@ -65,7 +68,8 @@ public: template std::shared_ptr - addLink(glm::vec3 a, glm::vec3 b, Params &&... params) requires std::is_base_of_v + addLink(glm::vec3 a, glm::vec3 b, Params &&... params) + requires std::is_base_of_v { const auto node1 = nodeAt(a), node2 = nodeAt(b); auto l {links.template create(node1, node2, std::forward(params)...)}; @@ -75,8 +79,10 @@ public: Link::CCollection candidateStraight(glm::vec3 n1, glm::vec3 n2) override; Link::CCollection candidateJoins(glm::vec3, glm::vec3) override; + Link::CCollection candidateExtend(glm::vec3, glm::vec3) override; Link::CCollection addStraight(glm::vec3 n1, glm::vec3 n2) override; Link::CCollection addJoins(glm::vec3, glm::vec3) override; + Link::CCollection addExtend(glm::vec3, glm::vec3) override; void render(const Shader &) const override; }; diff --git a/game/network/network.impl.h b/game/network/network.impl.h index 6769320..d112bf7 100644 --- a/game/network/network.impl.h +++ b/game/network/network.impl.h @@ -51,6 +51,13 @@ NetworkOf::candidateJoins(glm::vec3 n1, glm::vec3 n2) return {candidateLink(n1, n2)}; } +template +Link::CCollection +NetworkOf::candidateExtend(glm::vec3 n1, glm::vec3 n2) +{ + return {candidateLink(n1, n2)}; +} + template Link::CCollection NetworkOf::addStraight(glm::vec3 n1, glm::vec3 n2) @@ -64,3 +71,10 @@ NetworkOf::addJoins(glm::vec3 n1, glm::vec3 n2) { return {addLink(n1, n2)}; } + +template +Link::CCollection +NetworkOf::addExtend(glm::vec3 n1, glm::vec3 n2) +{ + return {addLink(n1, n2)}; +} -- cgit v1.2.3