9 #ifndef Navigation_PathClamperContext_H
10 #define Navigation_PathClamperContext_H
21 static const ClampNodeIndex ClampNodeIndex_Invalid =
KyUInt16MAXVAL;
27 ClampNode(
const Vec3f& pos, NodeTypeAndRawPtrDataIdx nodeTypeAndRawPtrDataIdx, ClampNodeIndex predecessorIdx, ClampNodeIndex nextNodeIdx);
28 ClampNode(
const Vec3f& pos,
const WorldIntegerPos& integerPos, NodeTypeAndRawPtrDataIdx nodeTypeAndRawPtrDataIdx, ClampNodeIndex predecessorIdx, ClampNodeIndex nextNodeIdx);
30 PathNodeType GetNodeType()
const;
33 void SetNodeType(PathNodeType nodeType);
34 void SetIdxOfRawPtrData(
KyUInt32 indexOfRawPtrData);
37 WorldIntegerPos m_nodeIntegerPos;
38 NodeTypeAndRawPtrDataIdx m_nodeTypeAndRawPtrDataIdx;
39 ClampNodeIndex m_predecessorNodeIdx;
40 ClampNodeIndex m_nextNodeIdx;
43 class PathRefinerContext;
44 class BaseRayCanGoQuery;
50 ClampResult_FAIL_MEMORYLIMIT,
51 ClampResult_FAIL_CANGOHIT
54 class PathClamperContext
59 enum PathClamperStatus
62 NeedToComputeIntersections,
63 ProcessingIntersections
67 ~PathClamperContext() { ReleaseWorkingMemory(); }
69 void ReleaseWorkingMemory()
71 m_triangleRawPtrNodes.ReleaseWorkingMemoryBuffer();
72 m_vertexRawPtrNodes.ReleaseWorkingMemoryBuffer();
73 m_clampNodes.ReleaseWorkingMemoryBuffer();
74 m_currentDestNavTrianglePtr.Invalidate();
75 m_clamperStatus = Initialisation;
76 m_currentClampNodeIdx = ClampNodeIndex_Invalid;
78 m_startNavGraphEdgePtr = NavGraphEdgePtr();
79 m_destNavGraphEdgePtr = NavGraphEdgePtr();
82 KyResult InitFromRefinerContext(WorkingMemory* workingMemory, PathRefinerContext* pathRefinerContext, PathClamperFlagMask pathClamperFlagMask);
83 KyResult InitFromCanGo(WorkingMemory* workingMemory, BaseRayCanGoQuery& baseRayCanGoQuery, PathClamperFlagMask pathClamperFlagMask);
84 KyResult InitFromChannel(Database* database, WorkingMemory* workingMemory,
const Channel& channel, PathClamperFlagMask pathClamperFlagMask);
86 bool IsClampingDone()
const {
return m_currentClampNodeIdx == 0; }
88 bool MustAddPointToStartOrDestClampNode(ClampNode* startOrDestClampNode,
const Vec3f& queryInputPosition)
const;
91 WorkingMemArray<ClampNode> m_clampNodes;
92 WorkingMemArray<NavTriangleRawPtr> m_triangleRawPtrNodes;
93 WorkingMemArray<NavGraphVertexRawPtr> m_vertexRawPtrNodes;
95 PathClamperStatus m_clamperStatus;
96 ClampNodeIndex m_currentClampNodeIdx;
97 KyUInt32 m_currentIntersectionLastIndex;
98 NavTrianglePtr m_currentDestNavTrianglePtr;
99 NavGraphEdgePtr m_startNavGraphEdgePtr;
100 NavGraphEdgePtr m_destNavGraphEdgePtr;
103 Vec3f m_currentStartPos;
104 NavTriangleRawPtr m_currentStartTriangleRawPtr;
105 WorldIntegerPos m_currentStartIntegerPos;
107 KyUInt16 m_currentIdxInTriangleBuffer;
109 PathClamperFlagMask m_pathClamperFlagMask;
115 KY_INLINE ClampNode::ClampNode() :
116 m_predecessorNodeIdx(ClampNodeIndex_Invalid),
117 m_nextNodeIdx(ClampNodeIndex_Invalid)
120 KY_INLINE ClampNode::ClampNode(
const Vec3f& pos, NodeTypeAndRawPtrDataIdx nodeTypeAndRawPtrDataIdx, ClampNodeIndex predecessorIdx, ClampNodeIndex nextNodeIdx) :
122 m_nodeTypeAndRawPtrDataIdx(nodeTypeAndRawPtrDataIdx),
123 m_predecessorNodeIdx(predecessorIdx),
124 m_nextNodeIdx(nextNodeIdx)
126 KY_INLINE ClampNode::ClampNode(
const Vec3f& pos,
const WorldIntegerPos& integerPos, NodeTypeAndRawPtrDataIdx nodeTypeAndRawPtrDataIdx, ClampNodeIndex predecessorIdx, ClampNodeIndex nextNodeIdx) :
128 m_nodeIntegerPos(integerPos),
129 m_nodeTypeAndRawPtrDataIdx(nodeTypeAndRawPtrDataIdx),
130 m_predecessorNodeIdx(predecessorIdx),
131 m_nextNodeIdx(nextNodeIdx)
134 KY_INLINE PathNodeType ClampNode::GetNodeType()
const {
return m_nodeTypeAndRawPtrDataIdx.GetNodeType(); }
135 KY_INLINE
KyUInt32 ClampNode::GetIdxOfRawPtrData()
const {
return m_nodeTypeAndRawPtrDataIdx.GetIdxOfRawPtrData(); }
137 KY_INLINE
void ClampNode::SetNodeType(PathNodeType nodeType) { m_nodeTypeAndRawPtrDataIdx.SetNodeType(nodeType); }
138 KY_INLINE
void ClampNode::SetIdxOfRawPtrData(
KyUInt32 indexOfRawPtrData) { m_nodeTypeAndRawPtrDataIdx.SetIdxOfRawPtrData(indexOfRawPtrData); }
143 #endif //Navigation_PathClamperContext_H
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
Definition: gamekitcrowddispersion.h:20
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
#define KyUInt16MAXVAL
The maximum value that can be stored in the KyUInt16 variable type.
Definition: types.h:230
unsigned short KyUInt16
Type used internally to represent an unsigned 16-bit integer.
Definition: types.h:40
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