7 #ifndef Navigation_AbstractGraphNodeRawPtr_H
8 #define Navigation_AbstractGraphNodeRawPtr_H
22 class NavHalfEdgeRawPtr;
24 class AbstractGraphNodeRawPtr
28 AbstractGraphNodeRawPtr() { Invalidate(); }
29 AbstractGraphNodeRawPtr(AbstractGraph* abstractGraph, AbstractGraphNodeIdx nodeIdx) { Set(abstractGraph, nodeIdx); }
31 KyResult InitFromNavHalfEdgeRawPtr(
const NavHalfEdgeRawPtr& navHalfEdgeRawPtr);
33 bool IsValid()
const {
return m_abstractGraph !=
KY_NULL && m_nodeIdx < AbstractGraphNodeIdx_Invalid; }
36 void Set(AbstractGraph* abstractGraph, AbstractGraphNodeIdx nodeIdx);
38 KyFloat32 GetNeighborCost(AbstractGraphNodeIdx abstractGraphNodeIdx)
const;
40 AbstractGraphNodeRawPtr GetPairedAbstractGraphNodeRawPtr()
const;
41 const AbstractGraphNodeLink& GetAbstractGraphNodeLink()
const;
46 Vec3f GetPosition()
const;
48 AbstractGraphCellGrid* GetAbstractGraphCellGrid()
const;
50 AbstractGraph* m_abstractGraph;
51 AbstractGraphNodeIdx m_nodeIdx;
56 KY_INLINE
void AbstractGraphNodeRawPtr::Invalidate()
59 m_nodeIdx = AbstractGraphNodeIdx_Invalid;
62 KY_INLINE
void AbstractGraphNodeRawPtr::Set(AbstractGraph* abstractGraph, AbstractGraphNodeIdx nodeIdx)
64 m_abstractGraph = abstractGraph;
68 KY_INLINE
KyFloat32 AbstractGraphNodeRawPtr::GetNeighborCost(AbstractGraphNodeIdx abstractGraphNodeIdx)
const
70 return m_abstractGraph->GetNeighborCost(m_nodeIdx, abstractGraphNodeIdx);
73 KY_INLINE
const AbstractGraphNodeLink& AbstractGraphNodeRawPtr::GetAbstractGraphNodeLink()
const {
return m_abstractGraph->m_links[m_nodeIdx]; }
74 KY_INLINE AbstractGraphNodeRawPtr AbstractGraphNodeRawPtr::GetPairedAbstractGraphNodeRawPtr()
const
76 const LoadedAbstractGraphNodeIdx& pairedNodeIdx = GetAbstractGraphNodeLink().m_pairedNodeIdx;
77 if (pairedNodeIdx.IsValid() ==
false)
78 return AbstractGraphNodeRawPtr();
80 AbstractGraphNodeRawPtr pairedNode;
81 pairedNode.m_abstractGraph = GetAbstractGraphCellGrid()->GetAbstractGraph(pairedNodeIdx);
82 pairedNode.m_nodeIdx = pairedNodeIdx.m_nodeIdx;
86 KY_INLINE AbstractGraphCellGrid* AbstractGraphNodeRawPtr::GetAbstractGraphCellGrid()
const {
return m_abstractGraph->GetAbstractGraphCellGrid(); }
88 KY_INLINE
NavFloorIdx AbstractGraphNodeRawPtr::GetOriginalNavFloorIdx()
const
90 const AbstractGraphCellFloorIndices& indices = m_abstractGraph->m_blob->m_graphNodeIdxToGraphCellFloorIndices.GetValues()[m_nodeIdx];
91 const AbstractGraphCellBlob* abstractCellBlob = m_abstractGraph->m_blob->m_abstractCells.GetValues()[indices.m_abstractCellIdx].Ptr();
92 return abstractCellBlob->m_abstractFloors.GetValues()[indices.m_abstractFloorIdx].Ptr()->m_originalNavFloorIdx;
95 KY_INLINE
CellPos AbstractGraphNodeRawPtr::GetCellPos()
const
97 const AbstractGraphCellFloorIndices& indices = m_abstractGraph->m_blob->m_graphNodeIdxToGraphCellFloorIndices.GetValues()[m_nodeIdx];
98 const AbstractGraphCellBlob* abstractCellBlob = m_abstractGraph->m_blob->m_abstractCells.GetValues()[indices.m_abstractCellIdx].Ptr();
99 return abstractCellBlob->m_cellPos;
102 KY_INLINE
CardinalDir AbstractGraphNodeRawPtr::GetCellBoundary()
const
104 const AbstractGraphCellFloorIndices& indices = m_abstractGraph->m_blob->m_graphNodeIdxToGraphCellFloorIndices.GetValues()[m_nodeIdx];
105 const AbstractGraphCellBlob* abstractCellBlob = m_abstractGraph->m_blob->m_abstractCells.GetValues()[indices.m_abstractCellIdx].Ptr();
106 const AbstractGraphFloorBlob* abstractFloorBlob = abstractCellBlob->m_abstractFloors.GetValues()[indices.m_abstractFloorIdx].Ptr();
107 return abstractFloorBlob->GetCellBoundaryDir(m_nodeIdx);
110 KY_INLINE Vec3f AbstractGraphNodeRawPtr::GetPosition()
const
112 return m_abstractGraph->GetNodePosition(m_nodeIdx);
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
Vec2i CellPos
A type that represents the position of a cell within a 2D grid.
Definition: navmeshtypes.h:33
#define KY_NULL
Null value.
Definition: types.h:247
KyUInt32 CardinalDir
Defines a type that refers to one of the cardinal points on the compass:
Definition: cardinaldir.h:23
KyUInt32 NavFloorIdx
An index that uniquely identifies a single NavFloor within the set of NavFloors owned by a NavCell...
Definition: navmeshtypes.h:115
Definition: gamekitcrowddispersion.h:20
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43