summaryrefslogtreecommitdiff
path: root/game/network/network.h
blob: 2c249164c606667c3463fae946625129f92c340b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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