17 class DatabaseGenMetrics;
37 inline const char* ToString(PathEdgeType e)
39 static const char* s_strs[] =
41 "PathEdgeType_Undefined",
42 "PathEdgeType_OnNavMesh",
43 "PathEdgeType_OnNavGraph",
44 "PathEdgeType_FromOutsideToNavMesh",
45 "PathEdgeType_FromNavMeshToOutside",
46 "PathEdgeType_FromOutsideToNavGraph",
47 "PathEdgeType_FromNavGraphToOutside",
48 "PathEdgeType_OutsideAlongGraphEdge",
49 "PathEdgeType_AbstractEdge"
51 const KyInt32 enumCount = PathEdgeType_Count;
52 KY_COMPILER_ASSERT(enumCount ==
sizeof(s_strs) /
sizeof(
const char*));
54 return idx >= 0 && idx < enumCount ? s_strs[idx] :
"PathEdgeType_UNKNOWN";
58 template <
class OSTREAM>
59 inline OSTREAM& operator<<(OSTREAM& os, PathEdgeType e) { os << ToString(e);
return os; }
88 void SetNavigationProfileId(
KyUInt32 navigationProfileId) { m_navigationProfileId = navigationProfileId; }
89 KyUInt32 GetNavigationProfileId()
const {
return m_navigationProfileId; }
93 KyUInt32 GetNodeCount()
const {
return m_nodesCount; }
94 KyUInt32 GetEdgeCount()
const {
return m_edgesCount; }
108 const Vec3f& GetPathStartPosition()
const {
return GetNodePosition(0); }
109 const Vec3f& GetPathEndPosition()
const {
return GetNodePosition(GetNodeCount() - 1); }
111 const Vec3f* GetNodePositionBuffer()
const {
return m_nodePositions; }
113 const Vec3f& GetNodePosition(
KyUInt32 nodeIdx)
const { KY_ASSERT(nodeIdx < m_nodesCount);
return m_nodePositions[nodeIdx]; }
114 Vec3f& GetNodePosition(
KyUInt32 nodeIdx) { KY_ASSERT(nodeIdx < m_nodesCount);
return m_nodePositions[nodeIdx]; }
116 const WorldIntegerPos* GetNodeIntegerPositionBuffer()
const {
return m_nodeIntegerPositions; }
118 const WorldIntegerPos& GetNodeIntegerPosition(
KyUInt32 nodeIdx)
const { KY_ASSERT(nodeIdx < m_nodesCount);
return m_nodeIntegerPositions[nodeIdx]; }
119 WorldIntegerPos& GetNodeIntegerPosition(
KyUInt32 nodeIdx) { KY_ASSERT(nodeIdx < m_nodesCount);
return m_nodeIntegerPositions[nodeIdx]; }
121 const NavTrianglePtr& GetNodeNavTrianglePtr(
KyUInt32 nodeIdx)
const { KY_ASSERT(nodeIdx < m_nodesCount);
return m_nodeTrianglePtrs[nodeIdx]; }
122 NavTrianglePtr& GetNodeNavTrianglePtr(
KyUInt32 nodeIdx) { KY_ASSERT(nodeIdx < m_nodesCount);
return m_nodeTrianglePtrs[nodeIdx]; }
124 const NavGraphVertexPtr& GetNodeNavGraphVertexPtr(
KyUInt32 nodeIdx)
const { KY_ASSERT(nodeIdx < m_nodesCount);
return m_nodeGraphVertexPtrs[nodeIdx]; }
125 NavGraphVertexPtr& GetNodeNavGraphVertexPtr(
KyUInt32 nodeIdx) { KY_ASSERT(nodeIdx < m_nodesCount);
return m_nodeGraphVertexPtrs[nodeIdx]; }
127 bool HasEpsilonEdges()
const;
131 const Vec3f& GetPathEdgeStartPosition(
KyUInt32 edgeIdx)
const {
return GetNodePosition(edgeIdx); }
132 const Vec3f& GetPathEdgeEndPosition(
KyUInt32 edgeIdx)
const {
return GetNodePosition(edgeIdx + 1); }
134 const NavTrianglePtr& GetPathEdgeStartNavTrianglePtr(
KyUInt32 edgeIdx)
const {
return GetNodeNavTrianglePtr(edgeIdx); }
135 const NavTrianglePtr& GetPathEdgeEndNavTrianglePtr(
KyUInt32 edgeIdx)
const {
return GetNodeNavTrianglePtr(edgeIdx + 1); }
137 const NavGraphEdgePtr& GetEdgeNavGraphEdgePtr(
KyUInt32 edgeIdx)
const { KY_ASSERT(edgeIdx < m_edgesCount);
return m_edgeNavGraphEdgePtr[edgeIdx]; }
138 NavGraphEdgePtr& GetEdgeNavGraphEdgePtr(
KyUInt32 edgeIdx) { KY_ASSERT(edgeIdx < m_edgesCount);
return m_edgeNavGraphEdgePtr[edgeIdx]; }
144 void SetNodePosition (
KyUInt32 nodeIdx,
const Vec3f& position ) { KY_ASSERT(nodeIdx < m_nodesCount); m_nodePositions[nodeIdx] = position; }
145 void SetNodeIntegerPosition (
KyUInt32 nodeIdx,
const WorldIntegerPos& integerPos ) { KY_ASSERT(nodeIdx < m_nodesCount); m_nodeIntegerPositions[nodeIdx] = integerPos; }
146 void SetNodeNavTrianglePtr (
KyUInt32 nodeIdx,
const NavTrianglePtr& navTrianglePtr ) { KY_ASSERT(nodeIdx < m_nodesCount); m_nodeTrianglePtrs[nodeIdx] = navTrianglePtr; }
147 void SetNodeNavGraphVertexPtr(
KyUInt32 nodeIdx,
const NavGraphVertexPtr& navGraphVertexPtr) { KY_ASSERT(nodeIdx < m_nodesCount); m_nodeGraphVertexPtrs[nodeIdx] = navGraphVertexPtr; }
149 void SetNodePosition3fAndInteger(
KyUInt32 nodeIdx,
const Vec3f& position,
const WorldIntegerPos& integerPos);
153 void SetEdgeNavGraphEdgePtr(
KyUInt32 edgeIdx,
const NavGraphEdgePtr& navGraphEdgePtr) { m_edgeNavGraphEdgePtr[edgeIdx] = navGraphEdgePtr; }
154 void SetPathEdgeType(
KyUInt32 edgeIdx,
PathEdgeType edgeType) { KY_ASSERT(edgeType < PathEdgeType_Count); m_edgeTypes[edgeIdx] = (
KyUInt8)edgeType; }
156 void SetPathCostAndDistance(
KyFloat32 pathCost,
KyFloat32 pathDistance) { m_pathCost = pathCost; m_pathDistance = pathDistance; }
158 const CellBox& GetPathCellBox()
const {
return m_pathCellBox; }
159 CellBox& GetPathCellBox() {
return m_pathCellBox; }
161 void SetPathCellBox(
const CellBox& cellBox) { m_pathCellBox = cellBox; }
163 void ComputeAllNodeIntegerPositionAndPathCellBox(
const DatabaseGenMetrics& genMetrics);
165 KyUInt32 GetByteSize()
const {
return m_byteSize; }
168 static KyUInt32 ComputeByteSize(
const CreateConfig& createConfig);
171 void ClearAllBeforeDestruction();
173 template <
class T>
void ClearBufferCPP(T*& buffer,
KyUInt32 count);
174 template <
class T>
void ClearBufferPOD(T*& buffer,
KyUInt32 count);
175 template <
class T>
void InitBufferCPP(T*& buffer,
KyUInt32 count,
char*& memory);
176 template <
class T>
void InitBufferPOD(T*& buffer,
KyUInt32 count,
char*& memory);
202 Vec3f* m_nodePositions;
215 void AddRef() { ++RefCount; }
219 int GetRefCount()
const {
return RefCount; }
static Ptr< Path > CreatePath(const CreateConfig &createConfig)
Creates a Path instance and allocates necessary memory accordingly to the information provided throug...
Definition: path.cpp:79
The PathEdgeType has not yet been set for the corresponding PathEdge.
Definition: path.h:24
2d axis aligned box of 32bits integers. Very Important: CountX() returns m_max.x - m_min...
Definition: box2i.h:17
The PathEdge is going from the NavMesh to outside.
Definition: path.h:28
Box2i CellBox
A type that represents a bounding box around cells in a 2D grid.
Definition: navmeshtypes.h:31
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
A class that configures the creation of a Path.
Definition: path.h:71
The PathEdge is going along an a NavGraphEdge but not starting nor ending at one of the NavGraphVerte...
Definition: path.h:31
Database * m_database
The Database on which the Path has been computed.
Definition: path.h:184
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:196
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
The PathEdge is coming from outside to a NavGraphVertex.
Definition: path.h:29
This class is a runtime container for all NavData that represents the world from the point of view of...
Definition: database.h:57
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
The PathEdge corresponds to a NavGraph edge.
Definition: path.h:26
The PathEdge is coming from outside to the NavMesh.
Definition: path.h:27
Each instance of this class uniquely identifies a single NavGraphVertex in a NavGraph.
Definition: navgraphvertexptr.h:17
std::int32_t KyInt32
int32_t
Definition: types.h:24
Utilities for dealing with NavData coordinates, which are expressed in a world space based on integer...
Definition: worldintegerpos.h:19
KyFloat32 GetPathCost() const
Retrieves the total sum of the cost calculated for each segment of the path by a RayCanGoQuery.
Definition: path.h:104
PathEdgeType
Defines the different kind of PathEdge within a Path.
Definition: path.h:22
The PathEdge has been computed on the NavMesh.
Definition: path.h:25
The PathEdge is going from a NavGraphVertex to outside.
Definition: path.h:30
Each instance of this class uniquely identifies a single NavTriangle in a NavFloor.
Definition: navtriangleptr.h:17
Ptr< ChannelArray > m_channelArray
The ChannelArray maintaining Channels around the path sections laying on the NavMesh.
Definition: path.h:187
KyFloat32 GetPathDistance() const
Retrieves the total sum of the distance covered by each segment of the path.
Definition: path.h:100
Each instance of this class uniquely identifies a single and mono-directionnal NavGraphEdge in a NavG...
Definition: navgraphedgeptr.h:20
std::uint8_t KyUInt8
uint8_t
Definition: types.h:27
The PathEdge is from an abstract Path.
Definition: path.h:32
The class representing a path.
Definition: path.h:62
float KyFloat32
float
Definition: types.h:32
3d vector using 32bits floating points.
Definition: vec3f.h:16