gwnavruntime/path/pathvalidityinterval.h Source File

pathvalidityinterval.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 
8 // primary contact: JUBA - secondary contact: NOBODY
9 
10 #ifndef Navigation_PathValidityInterval_H
11 #define Navigation_PathValidityInterval_H
12 
28 
29 namespace Kaim
30 {
31 
32 class LivePath;
33 
34 
35 enum UpperBoundType
36 {
37  UpperBoundType_PathLastNode = 0, // UpperBound is the last node of the Path
38  UpperBoundType_ValidityUpperBound, // UpperBound is the upper limit of the validity interval, Path is known to be invalid after it
39  UpperBoundType_PathInvalid, // Whole Path is considered invalid, no UpperBound
40  UpperBoundType_Temporary, // UpperBound is at a temporary position, validity after it is unknown but will be validated further in next frames
41  UpperBoundType_NoPath // No path, no UpperBound
42 };
43 
46 {
49 
52 
55 
59 
65 
70 
75 
80 
84 };
85 
86 
89 {
90 public:
91  // ---------------------------------- Public Member Functions ----------------------------------
92 
95  void Clear();
96  void ClearBounds();
97  void ClearBoundsAndEventList();
98 
99  UpperBoundType GetUpperBoundType() const;
100  PathValidityStatus GetPathValidityStatus() const;
101 
102  void SetPathValidityStatus(PathValidityStatus status);
103 
104  template<class TraverseLogic>
105  KyResult ReStartIntervalComputation(Path* path, void* traverseLogicUserData, const PositionOnPath& targetOnPath,
106  KyFloat32 minDistanceFromTargetOnPathBackward, KyFloat32 minDistanceFromTargetOnPathForward);
107 
108  enum FirstNewIntervalExtendedStatus
109  {
110  FirstNewIntervalIsNotAnExtension,
111  FirstNewIntervalIsAnExtension
112  };
113 
114  // if minimumDistanceAdvancement is 0, validate until the end of the path
115  template<class TraverseLogic>
116  KyResult ValidateForward(Path* path, void* traverseLogicUserData,
117  FirstNewIntervalExtendedStatus* firstIntervalStatus, KyFloat32 minimumDistanceAdvancement = 0.0f);
118 
119 
120 private:
121  KyResult ValidateTargetOnPath(PositionOnPath& targetOnPath);
122 
123  // if minimumdrawBackDistance is 0, validate until the beginning of the path
124  template<class TraverseLogic>
125  KyResult ValidateBackWard(Path* path, void* traverseLogicUserData, KyFloat32 minimumdrawBackDistance = 0.0f);
126 
127  template<class TraverseLogic>
128  KyResult TestCanGoToPrevPathNode(Path* path, void* traverseLogicUserData);
129  template<class TraverseLogic>
130  KyResult TestCanGoToNextPathNode(Path* path, void* traverseLogicUserData, FirstNewIntervalExtendedStatus* firstNewInterval);
131 
132  template<class TraverseLogic>
133  void FindLastValidPositionForward(Path* path, void* traverseLogicUserData, FirstNewIntervalExtendedStatus* firstNewInterval);
134  template<class TraverseLogic>
135  void FindLastValidPositionBackward(Path* path, void* traverseLogicUserData);
136 
137  template<class TraverseLogic>
138  void ValidateNavTagTransitionsBackward(void* traverseLogicUserData, const LogicDoNotUseCanEnterNavTag& navTagType);
139  template<class TraverseLogic>
140  void ValidateNavTagTransitionsBackward(void* traverseLogicUserData, const LogicDoUseCanEnterNavTag& navTagType);
141 
142  template<class TraverseLogic>
143  KyResult ValidateNavTagTransitionForward(void* traverseLogicUserData, KyUInt32 firstNewEvent, const LogicDoNotUseCanEnterNavTag& navTagType);
144  template<class TraverseLogic>
145  KyResult ValidateNavTagTransitionForward(void* traverseLogicUserData, KyUInt32 firstNewEvent,
146  const LogicDoUseCanEnterNavTag& navTagType);
147 
148 
149  // No need for traverseLogic since we already check navTags going backwards from the targetOnPath
150  KyResult BuildEventListFromLowerBoundToUpperBound(Path* path);
151 
152  void CreateIntervalForNavTagSubSegment(Path* path, KyUInt32 pathEdgeIdxToMoveOn, FirstNewIntervalExtendedStatus* firstNewInterval)
153  {
154  CreateIntervalsForNavTagSubsegmentButLast(path, pathEdgeIdxToMoveOn, firstNewInterval);
155  const PathEventType lastEventType = GetEventTypeForLastNavTagSubSegment(path, pathEdgeIdxToMoveOn);
156  CreateIntervalForLastNavTagSubSegment(path, pathEdgeIdxToMoveOn, lastEventType, firstNewInterval);
157  m_needToCheckLastEventForRemoval = (lastEventType == PathEventType_OnNavMeshPathNode);
158  }
159  void CreateIntervalsForNavTagSubsegmentButLast(Path* path, KyUInt32 pathEdgeIdxToMoveOn, FirstNewIntervalExtendedStatus* firstNewInterval);
160  void CreateIntervalForLastNavTagSubSegment(Path* path, KyUInt32 pathEdgeIdxToMoveOn, PathEventType typeOfLastEvent, FirstNewIntervalExtendedStatus* firstNewInterval);
161  void CheckIfLastEventShouldBeRemoved(const NavTagSubSegment& incomingNavTagSubSegment, FirstNewIntervalExtendedStatus* firstNewInterval);
162 
163  PathEventType GetEventTypeForLastNavTagSubSegment(Path* path, KyUInt32 pathEdgeIdxToMoveOn);
164  void CreateIntervalForGraphEdge(Path* path, KyUInt32 pathEdgeIdxToMoveOn);
165  void CreateIntervalForOutsideAlongGraphEdge(Path* path, KyUInt32 pathEdgeIdxToMoveOn);
166  void CreateIntervalForFromOutsidePathEdge(Path* path, KyUInt32 pathEdgeIdxToMoveOn);
167  void CreateIntervalForToOutsidePathEdge(Path* path, KyUInt32 pathEdgeIdxToMoveOn);
168 
169  PathEventType GetEventTypeFromLowerBound(Path* path, const PositionOnPath& posOnPath);
170  void SetPathEventStatusForLastEvent(PathEventStatusInList status);
171 
172  void CreateNewPathEvent(Path* path, KyUInt32 pathEdgeIdxToMoveOn, PathEventType pathEventType, const NavTagPtr& navTagptr);
173 
174  template<class TraverseLogic>
175  KyResult ValidateChannelSection(void* traverseLogicUserData, Path* path, KyUInt32 edgeIdx);
176 
177  template<class TraverseLogic>
178  KyResult ValidateChannelSection(void* traverseLogicUserData, Path* path, const ChannelSectionPtr &channelSectionPtr);
179  template<class TraverseLogic>
180  KyResult ValidateTriangle(void* traverseLogicUserData, Path* path, const Vec3f& a, const Vec3f& b, const Vec3f& c);
181  template<class TraverseLogic>
182  KyResult ValidateConvexQuad(void* traverseLogicUserData, Path* path, const Vec3f& a, const Vec3f& b, const Vec3f& c, const Vec3f& d);
183  template<class TraverseLogic, class EdgeIntersector>
184  KyResult PerformBreadthFirstSearchTraversal(void* traverseLogicUserData, Path* path, EdgeIntersector& intersector);
185 
186  template<class TraverseLogic>
187  KyResult ValidateChannelExtension(void* traverseLogicUserData, Path* path, const KyArray<Vec2f>& polyline);
188 
189 public: // internal
190  PathEventList m_pathEventList;
191 
192  PositionOnPath m_upperBound;
193  PositionOnPath m_lowerBound;
194 
195  NavTrianglePtr m_upperTrianglePtr;
196  NavTrianglePtr m_lowerTrianglePtr;
197 
198  PathValidityStatus m_pathValidityStatus;
199 
200  bool m_needToCheckLastEventForRemoval;
201  bool m_needToValidateChannelSections;
202 };
203 
204 }
205 
207 
208 #endif
The Path validity around the progress of the bot on path is limited:
Definition: pathvalidityinterval.h:79
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
No Path has been set yet.
Definition: pathvalidityinterval.h:48
This class aggregates all necessary information about a position on a Path, namely: ...
Definition: positiononpath.h:33
PathEventList aggregates all PathEvents and PathEventIntervals in a PathValidityInterval.
Definition: patheventlist.h:141
PathValidityInterval bound specific: bound reached start or end of the path or the max distance of va...
Definition: patheventlist.h:34
The Path has been completely checked and is valid.
Definition: pathvalidityinterval.h:51
NavData have changed around the Path, its validation is about to start.
Definition: pathvalidityinterval.h:54
This class represents a NavTag sub-segment of a ray (within a RayCastQuery or a RayCanGoQuery, carried out against the NavMesh).
Definition: navtagsubsegment.h:52
PathValidityStatus
Enumerate the different validity status of a LivePath.
Definition: pathvalidityinterval.h:45
General purpose array for movable objects that require explicit construction/destruction.
Definition: kyarray.h:118
The validation can not be processed at all.
Definition: pathvalidityinterval.h:64
Each instance of this class uniquely identifies a single NavFloor.
Definition: navtagptr.h:26
The Path is currently under validation.
Definition: pathvalidityinterval.h:58
Definition: gamekitcrowddispersion.h:20
PathEventStatusInList
Defines the PathEvent status relative to its place in the PathEventList.
Definition: patheventlist.h:42
The Path validity around the progress of the bot on path is limited:
Definition: pathvalidityinterval.h:69
Maintains runtime validity information on a given Path.
Definition: pathvalidityinterval.h:88
The Path validity around the progress of the bot on path is limited:
Definition: pathvalidityinterval.h:74
Each instance of this class uniquely identifies a single NavTriangle in a NavFloor.
Definition: navtriangleptr.h:22
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
The Path validity around the progress of the bot on path is limited: both backward and forward valida...
Definition: pathvalidityinterval.h:83
The class representing a path.
Definition: path.h:42
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43
This class defines a three-dimensional vector whose coordinates are stored using floating-point numbe...
Definition: vec3f.h:23
PathEventType
Defines the different kinds of PathEvent.
Definition: patheventlist.h:23