22 #include <AtomsUtils/Globals.h>
23 #include <AtomsUtils/NavigationMesh/Detour/DetourNavMesh.h>
30 DT_NODE_CLOSED = 0x02,
33 typedef unsigned short dtNodeIndex;
34 static const dtNodeIndex DT_NULL_IDX = (dtNodeIndex)~0;
57 inline unsigned int getNodeIdx(
const dtNode* node)
const
60 return (
unsigned int)(node - m_nodes)+1;
63 inline dtNode* getNodeAtIdx(
unsigned int idx)
66 return &m_nodes[idx-1];
69 inline const dtNode* getNodeAtIdx(
unsigned int idx)
const
72 return &m_nodes[idx-1];
75 inline int getMemUsed()
const
77 return sizeof(*this) +
78 sizeof(
dtNode)*m_maxNodes +
79 sizeof(dtNodeIndex)*m_maxNodes +
80 sizeof(dtNodeIndex)*m_hashSize;
83 inline int getMaxNodes()
const {
return m_maxNodes; }
88 inline int getMaxRuntimeNodes()
const {
return m_maxRuntimeNodes; }
90 inline int getNodeCount()
const {
return m_nodeCount; }
92 inline int getHashSize()
const {
return m_hashSize; }
93 inline dtNodeIndex getFirst(
int bucket)
const {
return m_first[bucket]; }
94 inline dtNodeIndex getNext(
int i)
const {
return m_next[i]; }
98 inline void setMaxRuntimeNodes(
const int newMaxRuntimeNodes) { m_maxRuntimeNodes = newMaxRuntimeNodes; }
104 dtNodeIndex* m_first;
106 const int m_maxNodes;
107 const int m_hashSize;
109 int m_maxRuntimeNodes;
133 dtNode* result = m_heap[0];
135 trickleDown(0, m_heap[m_size]);
139 inline void push(
dtNode* node)
142 bubbleUp(m_size-1, node);
145 inline void modify(
dtNode* node)
147 for (
int i = 0; i < m_size; ++i)
149 if (m_heap[i] == node)
157 inline bool empty()
const {
return m_size == 0; }
159 inline int getMemUsed()
const
161 return sizeof(*this) +
162 sizeof(
dtNode*)*(m_capacity+1);
165 inline int getCapacity()
const {
return m_capacity; }
168 void bubbleUp(
int i,
dtNode* node);
169 void trickleDown(
int i,
dtNode* node);
172 const int m_capacity;
Definition: DetourNode.h:48
Definition: DetourNode.h:115
Type_uint64 dtPolyRef
Definition: DetourNavMesh.h:47
AtomsCore namespace.
Definition: Base64.h:13
Definition: DetourNode.h:37
float cost
Cost from previous node to current node.
Definition: DetourNode.h:39
float total
Cost up to the node.
Definition: DetourNode.h:40
unsigned int flags
Node flags 0/open/closed.
Definition: DetourNode.h:42
float pos[3]
Position of the node.
Definition: DetourNode.h:38
dtPolyRef id
Polygon ref the node corresponds to.
Definition: DetourNode.h:43
unsigned int pidx
Index to parent node.
Definition: DetourNode.h:41