TazGraph Project v0.1.0
Loading...
Searching...
No Matches
CellEntity.h
1#pragma once
2
3#include "GECS.h"
4
5struct Cell {
6 std::vector<EmptyEntity*> emptyEntities;
7 std::vector<NodeEntity*> nodes;
8 std::vector<LinkEntity*> links;
9
10 glm::vec3 boundingBox_origin = glm::vec3(0); // Starting point (minimum corner) of the cell
11 glm::vec3 boundingBox_size = glm::vec3(0);
12 glm::vec3 boundingBox_center = glm::vec3(0);
13
14 Cell* parent = nullptr;
15 std::vector<Cell*> children;
16
17 template <typename T>
18 std::vector<T*>& getEntityList() {
19 if constexpr (std::is_same_v<T, NodeEntity>) {
20 return nodes;
21 }
22 else if constexpr (std::is_same_v<T, EmptyEntity>) {
23 return emptyEntities;
24 }
25 else if constexpr (std::is_same_v<T, LinkEntity>) {
26 return links;
27 }
28 else {
29 static_assert(sizeof(T) == 0, "Unsupported entity type.");
30 }
31 }
32};
33
34
35class CellEntity : public Entity {
36public:
37 Cell* ownerCell = nullptr;
38
39
40 CellEntity(Manager& mManager) : Entity(mManager) {
41
42 }
43
44 void setOwnerCell(Cell* cell) {
45 this->ownerCell = cell;
46 }
47
48
49 Cell* getOwnerCell() const { return ownerCell; }
50
51};
52
53class MultiCellEntity : public Entity {
54public:
55 std::vector<Cell*> ownerCells = {};
56
57 MultiCellEntity(Manager& mManager) : Entity(mManager) {
58
59 }
60
61 void setOwnerCells(std::vector<Cell*> cells) {
62 this->ownerCells = cells;
63 }
64
65 Cell* getOwnerCells() const { return ownerCells[0]; }
66
67};
Definition CellEntity.h:35
Definition GECS.h:140
Definition GECSManager.h:14
Definition CellEntity.h:53
Definition CellEntity.h:5