summaryrefslogtreecommitdiff
path: root/game/network/network.h
diff options
context:
space:
mode:
Diffstat (limited to 'game/network/network.h')
-rw-r--r--game/network/network.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/game/network/network.h b/game/network/network.h
index fa311ac..5725360 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,17 @@ protected:
std::shared_ptr<Texture> texture;
};
-template<typename T> class NetworkOf : public Network, public Renderable {
+template<typename LinkType> class NetworkLinkHolder {
+public:
+ // Implemented per LinkType to configure vao
+ NetworkLinkHolder();
+ friend LinkType;
+ glVertexArray vao;
+ 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 +86,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 +95,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;
}
@@ -98,8 +109,6 @@ public:
[[nodiscard]] float findNodeDirection(Node::AnyCPtr) const override;
- void render(const SceneShader &) const override;
-
protected:
Link::CCollection addJoins();
};