42 std::vector<EntityID> inLinks;
43 std::vector<EntityID> outLinks;
47 nodeComponentArray.emplace();
48 nodeComponentBitSet.emplace();
56 void removeEntityFromCell()
override {
57 auto* cell = ownerCell;
60 std::scoped_lock lock(cell->mtx);
62 auto& entities = cell->nodes;
63 auto it = std::find(entities.begin(), entities.end(), getId());
64 if (it != entities.end())
68 void addInLink(EntityID link) {
69 inLinks.push_back(link);
72 void addOutLink(EntityID link) {
73 outLinks.push_back(link);
76 void removeInLink(EntityID link) {
77 auto it = std::find(inLinks.begin(), inLinks.end(), link);
78 if (it != inLinks.end()) {
83 void removeOutLink(EntityID link) {
84 auto it = std::find(outLinks.begin(), outLinks.end(), link);
85 if (it != outLinks.end()) {
90 const std::vector<EntityID>& getInLinks()
const {
94 const std::vector<EntityID>& getOutLinks()
const {
98 virtual void addPorts() {}
100 virtual void removePorts() {}
101 virtual void removeSlots() {}
103 virtual void updatePorts(
float deltaTime) {}
114 enum class ConnectionType {
120 ConnectionType type = ConnectionType::NODE_TO_NODE;
125 glm::vec3 toPos = glm::vec3(0);
129 EntityID toPort = -1;
130 int fromSlotIndex = -1;
131 int toSlotIndex = -1;
139 type = ConnectionType::NODE_TO_NODE;
145 EntityID mfromId, EntityID mtoId,
146 EntityID m_fromPort, EntityID m_toPort,
int m_fromSlot,
int m_toSlot)
151 fromSlotIndex = m_fromSlot;
152 toSlotIndex = m_toSlot;
153 type = ConnectionType::PORT_TO_PORT;
158 glm::vec3 mfrom, glm::vec3 mto
162 type = ConnectionType::DIRECT_POSITIONS;
169 void removeFromCells()
override {
170 removeEntityFromCell();
174 void removeEntityFromCell()
override {
175 for (
auto& cell : ownerCells) {
179 std::scoped_lock lock(cell->mtx);
181 auto& links = cell->links;
182 auto it = std::find(links.begin(), links.end(), getId());
183 if (it != links.end()) {
189 EntityID getFromNode()
const {
193 EntityID getToNode()
const {
197 virtual void setConnectionType(ConnectionType setType) {}
199 virtual void updateConnection() {}
201 virtual void updatePortSlots() {}
203 virtual void updateArrowHeads() {}
205 virtual void addArrowHead() {}
207 virtual void removeArrowHead() {}