summaryrefslogtreecommitdiff
path: root/game/network/network.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-03-10 00:53:08 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-03-10 00:53:08 +0000
commitc274ac05690b34ba05b41d6e7864e6a663c73c1a (patch)
treeb73b3654ae8cd99deba893b278378a4831e5c70c /game/network/network.h
parentAdd findNodeAt to locate a node instance by position (diff)
downloadilt-c274ac05690b34ba05b41d6e7864e6a663c73c1a.tar.bz2
ilt-c274ac05690b34ba05b41d6e7864e6a663c73c1a.tar.xz
ilt-c274ac05690b34ba05b41d6e7864e6a663c73c1a.zip
Push RailLinks functionality into new base classes Network and NetworkOf<>
Diffstat (limited to 'game/network/network.h')
-rw-r--r--game/network/network.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/game/network/network.h b/game/network/network.h
new file mode 100644
index 0000000..2c24916
--- /dev/null
+++ b/game/network/network.h
@@ -0,0 +1,38 @@
+#ifndef NETWORK_H
+#define NETWORK_H
+
+#include "link.h"
+#include <collection.hpp>
+#include <gfx/renderable.h>
+#include <glm/glm.hpp>
+#include <memory>
+#include <set>
+#include <sorting.hpp>
+#include <string>
+
+class Texture;
+class Shader;
+
+class Network {
+public:
+ explicit Network(const std::string & textureName);
+
+ [[nodiscard]] NodePtr findNodeAt(glm::vec3) const;
+
+protected:
+ using Nodes = std::set<NodePtr, PtrSorter<NodePtr>>;
+ Nodes nodes;
+ std::shared_ptr<Texture> texture;
+};
+
+template<typename T> class NetworkOf : public Network, public Renderable {
+protected:
+ using Network::Network;
+
+ Collection<T> links;
+
+public:
+ void render(const Shader &) const override;
+};
+
+#endif