9 #ifndef Navigation_AStarTypes_H
10 #define Navigation_AStarTypes_H
26 static const AStarNodeIndex AStarNodeIndex_Invalid =
KyUInt32MAXVAL;
27 static const AStarNodeIndex AStarNodeIndex_StartNode = 0;
28 static const AStarNodeIndex AStarNodeIndex_DestNode = 1;
32 static const PathNodeType NodeType_NavMeshEdge = 0;
33 static const PathNodeType NodeType_NavGraphVertex = 1;
34 static const PathNodeType NodeType_AbstractGraphNode = 2;
35 static const PathNodeType NodeType_FreePositionOnNavMesh = 3;
36 static const PathNodeType NodeType_FreePositionOnGraphEdge = 4;
38 class NodeTypeAndRawPtrDataIdx
42 NodeTypeAndRawPtrDataIdx(PathNodeType aStarNodeType,
KyUInt32 indexOfRawPtrData) :
43 m_data((indexOfRawPtrData & 0x1FFFFFFF) | (aStarNodeType << 29))
45 KY_ASSERT((aStarNodeType & 0xFFFFFFF8) == 0);
48 PathNodeType GetNodeType()
const {
return (PathNodeType)(m_data >> 29); }
49 KyUInt32 GetIdxOfRawPtrData()
const {
return m_data & 0x1FFFFFFF; }
50 void SetNodeType(PathNodeType nodeType) { m_data = (m_data & 0x1FFFFFFF) | (nodeType << 29); }
52 void SetIdxOfRawPtrData(
KyUInt32 indexOfRawPtrData) { m_data = (indexOfRawPtrData & 0x1FFFFFFF) | (GetNodeType() << 29); }
63 m_estimatedCostToDest(0.f),
64 m_costMultiplierFromPredecessor(1.f),
65 m_indexOfPredecessor(AStarNodeIndex_Invalid),
66 m_indexInBinaryHeap(IndexInBinHeap_UnSet)
69 AStarNode(AStarNodeIndex indexOfPredecessor,
const Vec3f& pos, PathNodeType aStarNodeType,
KyUInt32 indexOfRawPtrData) :
72 m_estimatedCostToDest(0.f),
73 m_costMultiplierFromPredecessor(1.f),
74 m_nodeTypeAndRawPtrDataIdx(aStarNodeType, indexOfRawPtrData),
75 m_indexOfPredecessor(indexOfPredecessor),
76 m_indexInBinaryHeap(IndexInBinHeap_UnSet)
79 AStarNodeIndex GetIndexOfPredecessor()
const {
return m_indexOfPredecessor; }
80 void SetIndexOfPredecessor(AStarNodeIndex indexOfPredecessor) { m_indexOfPredecessor = indexOfPredecessor; }
82 PathNodeType GetNodeType()
const {
return m_nodeTypeAndRawPtrDataIdx.GetNodeType(); }
83 KyUInt32 GetIdxOfRawPtrData()
const {
return m_nodeTypeAndRawPtrDataIdx.GetIdxOfRawPtrData(); }
85 void SetNodeType(PathNodeType nodeType) { m_nodeTypeAndRawPtrDataIdx.SetNodeType(nodeType); }
86 void SetIdxOfRawPtrData(
KyUInt32 indexOfRawPtrData) { m_nodeTypeAndRawPtrDataIdx.SetIdxOfRawPtrData(indexOfRawPtrData); }
92 KyFloat32 m_costMultiplierFromPredecessor;
93 NodeTypeAndRawPtrDataIdx m_nodeTypeAndRawPtrDataIdx;
94 AStarNodeIndex m_indexOfPredecessor;
95 IndexInBinHeap m_indexInBinaryHeap;
105 #endif //Navigation_AStarTypes_H
#define KyFloat32MAXVAL
The maximum value that can be stored in the KyFloat32 variable type.
Definition: types.h:227
#define KyUInt8MAXVAL
The maximum value that can be stored in the KyUInt8 variable type.
Definition: types.h:233
unsigned char KyUInt8
Type used internally to represent an unsigned 8-bit integer.
Definition: types.h:41
Definition: gamekitcrowddispersion.h:20
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
#define KyUInt32MAXVAL
The maximum value that can be stored in the KyUInt32 variable type.
Definition: types.h:226
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43