diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-03-13 18:57:07 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-03-13 18:59:43 +0000 |
commit | 81e2f0082ee2c5b3584135467c94111565a776b1 (patch) | |
tree | 00c23d71090ac55c5d8218f5e86212992f2e1453 /game/network/rail.h | |
parent | More complete tests for route finding (diff) | |
download | ilt-81e2f0082ee2c5b3584135467c94111565a776b1.tar.bz2 ilt-81e2f0082ee2c5b3584135467c94111565a776b1.tar.xz ilt-81e2f0082ee2c5b3584135467c94111565a776b1.zip |
Add generic middle classes LinkStraight and LinkCurve
Diffstat (limited to 'game/network/rail.h')
-rw-r--r-- | game/network/rail.h | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/game/network/rail.h b/game/network/rail.h index 3ecc59f..bfbb928 100644 --- a/game/network/rail.h +++ b/game/network/rail.h @@ -7,46 +7,45 @@ #include "link.h" #include "network.h" #include <glm/glm.hpp> -#include <location.hpp> -#include <maths.h> #include <memory> #include <span> +#include <special_members.hpp> class Shader; class Vertex; +struct Arc; // A piece of rail track -class RailLink : public Link, public Renderable { +class RailLink : public virtual Link, public Renderable { public: - using Link::Link; - + RailLink() = default; + inline ~RailLink() override = 0; void render(const Shader &) const override; + NO_COPY(RailLink); + NO_MOVE(RailLink); protected: + [[nodiscard]] glm::vec3 vehiclePositionOffset() const override; [[nodiscard]] static MeshPtr defaultMesh(const std::span<Vertex> vertices); MeshPtr mesh; }; +RailLink::~RailLink() = default; -class RailLinkStraight : public RailLink { +class RailLinkStraight : public RailLink, public LinkStraight { public: RailLinkStraight(const NodePtr &, const NodePtr &); - [[nodiscard]] Location positionAt(float dist, unsigned char start) const override; private: RailLinkStraight(NodePtr, NodePtr, const glm::vec3 & diff); }; -class RailLinkCurve : public RailLink { +class RailLinkCurve : public RailLink, public LinkCurve { public: RailLinkCurve(const NodePtr &, const NodePtr &, glm::vec2); - [[nodiscard]] Location positionAt(float dist, unsigned char start) const override; private: RailLinkCurve(const NodePtr &, const NodePtr &, glm::vec3, const Arc); - glm::vec3 centreBase; - float radius; - Arc arc; }; class RailLinks : public NetworkOf<RailLink>, public WorldObject { |