From df9b9bc264e0bf12e99b447be7903050c822692d Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 10 May 2025 13:50:08 +0100 Subject: Add new network building interface Imperfect, matches some legacy interface in places, has some TODO notes. --- game/network/network.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'game/network/network.h') diff --git a/game/network/network.h b/game/network/network.h index 4f5d2b0..114f42b 100644 --- a/game/network/network.h +++ b/game/network/network.h @@ -19,8 +19,19 @@ class GeoData; template class Ray; template using GenDef = std::tuple...>; +using GenStraightDef = GenDef<3, 3>; using GenCurveDef = GenDef<3, 3, 2>; +struct CreationDefinitionEnd { + GlobalPosition3D position; + std::optional direction; +}; + +struct CreationDefinition { + CreationDefinitionEnd fromEnd; + CreationDefinitionEnd toEnd; +}; + class Network { public: using LinkEnd = std::pair; @@ -49,6 +60,9 @@ public: [[nodiscard]] virtual float findNodeDirection(Node::AnyCPtr) const = 0; + [[nodiscard]] Link::Collection create(const CreationDefinition &); + virtual void add(const GeoData *, const Link::Ptr &) = 0; + [[nodiscard]] virtual const Surface * getBaseSurface() const = 0; [[nodiscard]] virtual RelativeDistance getBaseWidth() const = 0; @@ -58,6 +72,9 @@ protected: static std::pair genCurveDef( const GlobalPosition3D & start, const GlobalPosition3D & end, float startDir, float endDir); + [[nodiscard]] virtual Link::Ptr create(const GenStraightDef &) = 0; + [[nodiscard]] virtual Link::Ptr create(const GenCurveDef &) = 0; + using Nodes = std::set>; Nodes nodes; Texture::Ptr texture; @@ -111,6 +128,10 @@ public: Link::CCollection addExtend(const GeoData *, GlobalPosition3D, GlobalPosition3D) override; [[nodiscard]] float findNodeDirection(Node::AnyCPtr) const override; + using Network::create; + [[nodiscard]] Link::Ptr create(const GenStraightDef &) override; + [[nodiscard]] Link::Ptr create(const GenCurveDef &) override; + void add(const GeoData *, const Link::Ptr &) override; protected: Link::CCollection addCurve(const GeoData *, const GenCurveDef &); -- cgit v1.2.3