-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNavGrid.h
More file actions
44 lines (34 loc) · 820 Bytes
/
NavGrid.h
File metadata and controls
44 lines (34 loc) · 820 Bytes
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
39
40
41
42
43
44
#pragma once
namespace KE
{
struct NavNode;
class Navmesh;
class GridCell
{
friend class NavGrid;
public:
GridCell() {};
~GridCell() {};
inline std::vector<KE::NavNode*> GetNodes() { return myData; };
private:
std::vector<KE::NavNode*> myData;
};
class NavGrid
{
friend class KE::Navmesh;
public:
NavGrid() {};
~NavGrid() {};
NavGrid(Vector2i aGridSize, float aCellSize);
bool Init(float aCellSize, Vector3f aMin, Vector3f aMax, std::vector<KE::NavNode>& someNodes);
int GetIndexByPos(Vector3f aPos);
Vector2i GetCoordinate(Vector3f aPos);
std::vector<KE::NavNode*> GetNodesByPos(Vector3f aPos);
private:
float myCellSize = 0;
Vector2f myMin;
Vector2f myMax;
Vector2i myGridSize;
std::vector<GridCell> myNavGrid;
};
}