summaryrefslogtreecommitdiff
path: root/game/network/network.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-17 01:08:54 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-20 15:08:43 +0000
commita6e28fe377b41500d6ce3e0a9a4d6e6288d97f61 (patch)
tree7a77359865cb1359071d91ded0f0c574f57215bb /game/network/network.h
parentAdd mail rail network to render test, include curves (diff)
downloadilt-a6e28fe377b41500d6ce3e0a9a4d6e6288d97f61.tar.bz2
ilt-a6e28fe377b41500d6ce3e0a9a4d6e6288d97f61.tar.xz
ilt-a6e28fe377b41500d6ce3e0a9a4d6e6288d97f61.zip
Copy render vital link data to vertex buffer
Diffstat (limited to 'game/network/network.h')
-rw-r--r--game/network/network.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/game/network/network.h b/game/network/network.h
index fa311ac..12c006c 100644
--- a/game/network/network.h
+++ b/game/network/network.h
@@ -1,5 +1,6 @@
#pragma once
+#include "gfx/gl/instanceVertices.h"
#include "link.h"
#include <collection.h>
#include <gfx/renderable.h>
@@ -58,7 +59,13 @@ protected:
std::shared_ptr<Texture> texture;
};
-template<typename T> class NetworkOf : public Network, public Renderable {
+template<typename LinkType> class NetworkLinkHolder {
+ friend LinkType;
+ mutable InstanceVertices<typename LinkType::Vertex> vertices;
+};
+
+template<typename T, typename... Links>
+class NetworkOf : public Network, public Renderable, public NetworkLinkHolder<Links>... {
protected:
using Network::Network;
@@ -75,7 +82,7 @@ public:
requires std::is_base_of_v<T, L>
{
const auto node1 = candidateNodeAt(a).first, node2 = candidateNodeAt(b).first;
- return std::make_shared<L>(node1, node2, std::forward<Params>(params)...);
+ return std::make_shared<L>(*this, node1, node2, std::forward<Params>(params)...);
}
template<typename L, typename... Params>
@@ -84,7 +91,7 @@ public:
requires std::is_base_of_v<T, L>
{
const auto node1 = nodeAt(a), node2 = nodeAt(b);
- auto l {links.template create<L>(node1, node2, std::forward<Params>(params)...)};
+ auto l {links.template create<L>(*this, node1, node2, std::forward<Params>(params)...)};
joinLinks(l);
return l;
}