Skylicht Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
Graph
CGraphComponent.h
1
/*
2
!@
3
MIT License
4
5
Copyright (c) 2024 Skylicht Technology CO., LTD
6
7
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
8
(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
9
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
10
subject to the following conditions:
11
12
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
14
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19
20
This file is part of the "Skylicht Engine".
21
https://github.com/skylicht-lab/skylicht-engine
22
!#
23
*/
24
25
#pragma once
26
27
#include "Components/CComponentSystem.h"
28
29
#include "Graph/CGraphQuery.h"
30
#include "RecastMesh/CRecastBuilder.h"
31
#include "RecastMesh/CRecastMesh.h"
32
#include "WalkingMap/CWalkingTileMap.h"
33
34
namespace
Skylicht
35
{
40
namespace
Graph
41
{
42
class
CGraphComponent :
public
CComponentSystem
43
{
44
protected
:
45
CGraphQuery
* m_query;
46
CRecastBuilder
* m_builder;
47
CRecastMesh
* m_recastMesh;
48
CObstacleAvoidance
* m_obstacle;
49
CWalkingTileMap
* m_walkingTileMap;
50
51
float
m_cellSize;
52
float
m_cellHeight;
53
float
m_agentHeight;
54
float
m_agentRadius;
55
float
m_agentMaxClimb;
56
float
m_agentMaxSlope;
57
float
m_walkTileWidth;
58
float
m_walkTileHeight;
59
60
std::string m_inputCollision;
61
std::string m_inputRecastMesh;
62
std::string m_inputWalkingTileMap;
63
64
CMesh
* m_navMesh;
65
public
:
66
CGraphComponent();
67
68
virtual
~CGraphComponent();
69
70
virtual
void
initComponent();
71
72
virtual
void
startComponent();
73
74
virtual
void
updateComponent();
75
76
virtual
CObjectSerializable
* createSerializable();
77
78
virtual
void
loadSerializable(
CObjectSerializable
*
object
);
79
80
inline
void
setInputMeshCollision(
const
char
* source)
81
{
82
m_inputCollision = source;
83
}
84
85
inline
const
char
* getInputMeshCollision()
86
{
87
return
m_inputCollision.c_str();
88
}
89
90
inline
void
setInputRecastMesh(
const
char
* source)
91
{
92
m_inputRecastMesh = source;
93
}
94
95
inline
const
char
* getInputRecastMesh()
96
{
97
return
m_inputRecastMesh.c_str();
98
}
99
100
inline
bool
haveInputRecastMesh()
101
{
102
return
!m_inputRecastMesh.empty();
103
}
104
105
inline
CMesh
* getNavMesh()
106
{
107
return
m_navMesh;
108
}
109
110
inline
CObstacleAvoidance
* getObstacle()
111
{
112
return
m_obstacle;
113
}
114
115
inline
CWalkingTileMap
* getWalkingMap()
116
{
117
return
m_walkingTileMap;
118
}
119
120
inline
CGraphQuery
* getQuery()
121
{
122
return
m_query;
123
}
124
125
bool
loadRecastMesh();
126
127
bool
buildRecastMesh();
128
129
bool
beginBuildWalkingMap();
130
131
bool
updateBuildWalkingMap();
132
133
float
getBuildPercent();
134
135
bool
saveWalkMap(
const
char
* output);
136
137
bool
loadWalkMap();
138
139
void
release();
140
141
DECLARE_GETTYPENAME(CGraphComponent)
142
};
143
}
144
}
Skylicht::CMesh
Definition
CMesh.h:75
Skylicht::CObjectSerializable
Definition
CObjectSerializable.h:36
Skylicht::Graph::CGraphQuery
Definition
CGraphQuery.h:83
Skylicht::Graph::CObstacleAvoidance
Definition
CObstacleAvoidance.h:38
Skylicht::Graph::CRecastBuilder
Definition
CRecastBuilder.h:70
Skylicht::Graph::CRecastMesh
Definition
CRecastMesh.h:35
Skylicht::Graph::CWalkingTileMap
Definition
CWalkingTileMap.h:106
Skylicht::Graph
Component that manages the navigation lifecycle, including NavMesh generation and pathfinding.
Definition
CGraphComponent.h:41
Skylicht
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition
AudioDebugLog.h:29
Generated by
1.17.0