From c1ea14d1c96de18448c0c3779d30b7e1e4451f61 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 5 Feb 2021 00:30:13 +0000 Subject: Initial commit generating some basic rail network --- game/network/rail.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 game/network/rail.h (limited to 'game/network/rail.h') diff --git a/game/network/rail.h b/game/network/rail.h new file mode 100644 index 0000000..ef119bc --- /dev/null +++ b/game/network/rail.h @@ -0,0 +1,52 @@ +#ifndef RAILLINKS_H +#define RAILLINKS_H + +#include "collection.hpp" +#include "game/worldobject.h" +#include "gfx/models/mesh.h" +#include "gfx/models/vertex.hpp" +#include "gfx/renderable.h" +#include "link.h" +#include +#include +#include +#include +class Shader; +class Texture; + +// A piece of rail track +class RailLink : public Link, public Renderable { +public: + using Link::Link; + + void render(const Shader &) const override; + +protected: + RailLink(); + Collection meshes; + std::vector vertices; + std::vector indices; +}; + +class RailLinkStraight : public RailLink { +public: + RailLinkStraight(End, End); +}; + +template concept RailLinkConcept = std::is_base_of_v; + +class RailLinks : public Renderable, public WorldObject { +public: + RailLinks(); + template std::shared_ptr addLink(glm::vec3, glm::vec3); + +private: + using Nodes = std::set>; + Collection links; + Nodes nodes; + void render(const Shader &) const override; + void tick(TickDuration elapsed) override; + std::shared_ptr texture; +}; + +#endif -- cgit v1.2.3