From c274ac05690b34ba05b41d6e7864e6a663c73c1a Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 10 Mar 2021 00:53:08 +0000 Subject: Push RailLinks functionality into new base classes Network and NetworkOf<> --- game/network/rail.cpp | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) (limited to 'game/network/rail.cpp') diff --git a/game/network/rail.cpp b/game/network/rail.cpp index 8ec6893..133b80c 100644 --- a/game/network/rail.cpp +++ b/game/network/rail.cpp @@ -1,11 +1,10 @@ #include "rail.h" -#include "game/network/link.h" +#include "network.h" #include #include -#include #include -#include -#include +#include +#include // IWYU pragma: keep #include #include #include @@ -14,10 +13,12 @@ #include #include +template class NetworkOf; + constexpr auto RAIL_CROSSSECTION_VERTICES {5U}; constexpr glm::vec3 RAIL_HEIGHT {0, .25F, 0}; -RailLinks::RailLinks() : texture {Texture::cachedTexture.get("rails.jpg")} { } +RailLinks::RailLinks() : NetworkOf {"rails.jpg"} { } void RailLinks::tick(TickDuration) { } void @@ -37,15 +38,6 @@ RailLinks::joinLinks(const LinkPtr & l) const } } -NodePtr -RailLinks::findNodeAt(glm::vec3 pos) const -{ - if (const auto n = nodes.find(std::make_shared(pos)); n != nodes.end()) { - return *n; - } - return {}; -} - std::shared_ptr RailLinks::addLinksBetween(glm::vec3 start, glm::vec3 end) { @@ -110,14 +102,6 @@ RailLinks::addLinksBetween(glm::vec3 start, glm::vec3 end) return addLink(start, end, centre.first); } -void -RailLinks::render(const Shader & shader) const -{ - shader.setModel(Location {}, Shader::Program::StaticPos); - texture->Bind(); - links.apply(&RailLink::render, shader); -} - void RailLink::defaultMesh() { -- cgit v1.2.3