gwnavruntime/path/livepath.h Source File

livepath.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: GUAL - secondary contact: LAPA
9 
10 #ifndef Navigation_LivePath_H
11 #define Navigation_LivePath_H
12 
13 #include "gwnavruntime/path/path.h"
15 
16 namespace Kaim
17 {
18 
19 class Path;
20 class ChannelArray;
21 class Bot;
22 class IPathFinderQuery;
23 
24 class LivePathOnPathCalculated : public IOnDone
25 {
26 public:
27  LivePathOnPathCalculated(LivePath* livePath) : m_livePath(livePath) {}
28  virtual ~LivePathOnPathCalculated() {}
29  virtual void OnDone();
30 public:
31  LivePath* m_livePath;
32  Ptr<IOnDone> m_preSetOnDone;
33 };
34 
35 enum PathFinderQueryStatus
36 {
37  PathFinderQueryStatus_Idle,
38  PathFinderQueryStatus_Computing,
39 };
40 
42 enum PathSource
43 {
47 };
48 
49 
57 class LivePath
58 {
61 public:
62  // ---------------------------------- Main API Functions ----------------------------------
63 
64  LivePath();
65  ~LivePath();
66 
67  void Clear();
68 
71  bool IsComputingNewPath() const;
72 
75 
76  // ---------------------------------- Getters ----------------------------------
77 
78  Path* GetFollowedPath() const;
79  PathSource GetFollowedPathSource() const;
80  PathValidityStatus GetPathValidityStatus() const;
81  const PathEventList& GetPathEventList() const;
82  const IPathFinderQuery* GetPathFinderQuery() const;
83  ChannelArray* GetChannelArray() const;
84 
85  PathEventList& GetPathEventList();
86  UpperBoundType GetUpperBoundType() const;
87 
88  // ---------------------------------- Path Following Control ----------------------------------
89 
93 
94 public://Internal
98  void InjectUserPath(Path* newPath);
99 
103 
104  template<class TraverseLogic>
105  KyResult ReStartIntervalComputation(void* traverseLogicUserData, const PositionOnPath& targetOnPath,
106  KyFloat32 minDistanceFromTargetOnPathBackward, KyFloat32 minDistanceFromTargetOnPathFrowaard);
107 
108  template<class TraverseLogic>
109  KyResult ValidateForward(void* traverseLogicUserData, KyFloat32 minimumDistanceAdvancement,
110  PathValidityInterval::FirstNewIntervalExtendedStatus* firstIntervalStatus);
111 
112  void* GetBotTraverseLogicUserData() const;
113  void SetBotTraverseLogicUserData(void* traverseLogicUserData);
114 
119 
120 private:
121  void SetNewPath(Path* newPath, PathSource pathType);
122  friend class Bot;
123  void ClearFollowedPath();
124  void ComputeNewPathAsync(IPathFinderQuery* pathFinderQuery);
125  void CancelAsyncPathComputation();
126 
127 public: // internal
128  Bot* m_bot;
129 
130  Ptr<LivePathOnPathCalculated> m_onPathCalculated;
131 
132  Ptr<Path> m_followedPath;
133  Ptr<Path> m_newPath;
134 
137  PathFinderQueryStatus m_pathFinderQueryStatus;
138 
139  PathValidityInterval m_validityInterval;
140 
142 };
143 
144 }
145 
146 #include "gwnavruntime/path/livepath.inl"
147 
148 
149 #endif
This class is the world element that represent an active character in Gameware Navigation.
Definition: bot.h:150
Base class for all pathfinder queries.
Definition: ipathfinderquery.h:38
The Path has not been set yet or has been Cleared.
Definition: livepath.h:46
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
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
bool NeedToReplaceCurrentPathWithNewPath() const
Returns whether or not a new Path has been set and is ready to be followed.
Definition: livepath.inl:33
PathSource m_pathType
The source of the current Path.
Definition: livepath.h:158
bool m_needToSendLivePathBlob
(VisualDebug) Avoids sending all the active KyGuid each frame. Accessed by the Bot.
Definition: livepath.h:164
PathValidityStatus
Enumerate the different validity status of a LivePath.
Definition: pathvalidityinterval.h:45
The Path has been computed by a IPathFinderQuery.
Definition: livepath.h:47
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
This class aggregates Channels along a Path.
Definition: channelarray.h:31
void ReplaceCurrentPathWithNewPath()
This method is called to properly switch between the currently followed Path and the new one freshly ...
PathSource
Enumerates the possible source for a new Path.
Definition: livepath.h:44
The Path has been injected by the user.
Definition: livepath.h:48
void ForceValidityIntervalRecompute()
Call this method to force an update of the PathValidityInterval.
Definition: livepath.inl:38
Definition: gamekitcrowddispersion.h:20
Ptr< Path > m_newPath
The new Path that has just been set.
Definition: livepath.h:156
void InjectUserPath(Path *newPath)
Calls SetPath() to inject newPath and set m_newPathSource to PathSource_UserInjected.
Definition: livepath.inl:36
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
bool IsComputingNewPath() const
Returns true if a path computation has been launched with the PathFinderQuery and the followed path h...
Definition: livepath.inl:34
Maintains runtime validity information on a given Path.
Definition: pathvalidityinterval.h:88
PathSource m_newPathSource
The source of the new Path that has just been set.
Definition: livepath.h:159
void InjectPathFromPathFinderQueryOnDone(Path *newPath)
Calls SetPath() to inject newPath and set m_newPathSource to Called internally by the Bot or by the L...
Definition: livepath.inl:37
This class aggregates a Path and all runtime related stuff namely the PathValidityInterval.
Definition: livepath.h:59
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