gwnavruntime/path/livepath.h Source File

livepath.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 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 #pragma once
9 
10 #include "gwnavruntime/path/path.h"
12 
13 namespace Kaim
14 {
15 
16 class Path;
17 class ChannelArray;
18 class Bot;
19 class IPathFinderQuery;
20 
21 class LivePathOnPathCalculated : public IOnDone
22 {
23 public:
24  LivePathOnPathCalculated(LivePath* livePath) : m_livePath(livePath) {}
25  virtual ~LivePathOnPathCalculated() {}
26  virtual void OnDone();
27 public:
28  LivePath* m_livePath;
29  Ptr<IOnDone> m_preSetOnDone;
30 };
31 
32 enum PathFinderQueryStatus
33 {
34  PathFinderQueryStatus_Idle,
35  PathFinderQueryStatus_Computing,
36 };
37 
40 {
44 };
45 
46 
54 class LivePath
55 {
56  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_Path)
58 public:
59  // ---------------------------------- Main API Functions ----------------------------------
60 
61  LivePath();
62  ~LivePath();
63 
64  void Clear();
65 
68  bool IsComputingNewPath() const;
69 
72 
73  // ---------------------------------- Getters ----------------------------------
74 
75  Path* GetFollowedPath() const;
76  PathSource GetFollowedPathSource() const;
77  PathValidityStatus GetPathValidityStatus() const;
78  const PathEventList& GetPathEventList() const;
79  ChannelArray* GetChannelArray() const;
80 
81  PathEventList& GetPathEventList();
82  UpperBoundType GetUpperBoundType() const;
83 
84  // ---------------------------------- Path Following Control ----------------------------------
85 
89 
90 public://Internal
94  void InjectUserPath(Path* newPath);
95 
99 
100  template<class TraverseLogic>
101  KyResult ReStartIntervalComputation(void* traverseLogicUserData, const PositionOnPath& targetOnPath,
102  KyFloat32 minDistanceFromTargetOnPathBackward, KyFloat32 minDistanceFromTargetOnPathFrowaard);
103 
104  template<class TraverseLogic>
105  KyResult ValidateForward(void* traverseLogicUserData, KyFloat32 minimumDistanceAdvancement,
106  PathValidityInterval::FirstNewIntervalExtendedStatus* firstIntervalStatus);
107 
112 
113 private:
114  void SetNewPath(Path* newPath, PathSource pathType);
115  friend class Bot;
116  void ClearFollowedPath();
117  void ComputeNewPathAsync(IPathFinderQuery* pathFinderQuery);
118  void CancelAsyncPathComputation();
119 
120 public: // internal
121  Bot* m_bot;
122 
123  Ptr<LivePathOnPathCalculated> m_onPathCalculated;
124 
125  Ptr<Path> m_followedPath;
126  Ptr<Path> m_newPath;
127 
130  PathFinderQueryStatus m_pathFinderQueryStatus;
131 
132  PathValidityInterval m_validityInterval;
133 
135 };
136 
137 }
138 
140 
141 
This class is the world element that represent an active character in Autodesk Navigation.
Definition: bot.h:128
Base class for all pathfinder queries.
Definition: ipathfinderquery.h:34
The Path has not been set yet or has been Cleared.
Definition: livepath.h:41
This class aggregates all necessary information about a position on a Path.
Definition: positiononpath.h:29
PathEventList aggregates all PathEvents and PathEventIntervals in a PathValidityInterval.
Definition: patheventlist.h:117
bool NeedToReplaceCurrentPathWithNewPath() const
Returns whether or not a new Path has been set and is ready to be followed.
Definition: livepath.inl:30
PathSource m_pathType
The source of the current Path.
Definition: livepath.h:128
bool m_needToSendLivePathBlob
(VisualDebug) Avoids sending all the active KyGuid each frame. Accessed by the Bot.
Definition: livepath.h:134
PathValidityStatus
Enumerate the different validity status of a LivePath.
Definition: pathvalidityinterval.h:42
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:196
This class aggregates Channels along a Path.
Definition: channelarray.h:27
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
The Path has been computed by a IPathFinderQuery.
Definition: livepath.h:42
void ReplaceCurrentPathWithNewPath()
This method is called to properly switch between the currently followed Path and the new one freshly ...
Definition: livepath.cpp:106
PathSource
Enumerates the possible source for a new Path.
Definition: livepath.h:39
The Path has been injected by the user.
Definition: livepath.h:43
Navigation return code class.
Definition: types.h:108
void ForceValidityIntervalRecompute()
Call this method to force an update of the PathValidityInterval.
Definition: livepath.inl:35
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
Ptr< Path > m_newPath
The new Path that has just been set.
Definition: livepath.h:126
void InjectUserPath(Path *newPath)
Calls SetPath() to inject newPath and set m_newPathSource to PathSource_UserInjected.
Definition: livepath.inl:33
bool IsComputingNewPath() const
Returns true if a path computation has been launched with the PathFinderQuery and the followed path h...
Definition: livepath.inl:31
Maintains runtime validity information on a given Path.
Definition: pathvalidityinterval.h:110
PathSource m_newPathSource
The source of the new Path that has just been set.
Definition: livepath.h:129
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:34
This class aggregates a Path and all runtime related stuff namely the PathValidityInterval.
Definition: livepath.h:54
The class representing a path.
Definition: path.h:62
float KyFloat32
float
Definition: types.h:32