gwnavruntime/pathfollower/manualcontrolinterval.h Source File

manualcontrolinterval.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 #ifndef Navigation_ManualControlInterval_H
9 #define Navigation_ManualControlInterval_H
10 
12 
13 namespace Kaim
14 {
15 class PathValidityInterval;
16 class Bot;
17 
19 {
25 };
26 
27 // Beware that ManualControlInterval should not be maintain over several frames
28 // due to PositionOnLivePath members whose validity must be maintained by the Bot
29 class ManualControlInterval
30 {
32  KY_CLASS_WITHOUT_COPY(ManualControlInterval)
33 
34 public:
35  ManualControlInterval(Bot* bot);
36 
37  // Find the ManualControl entry and exit points based on the given NavTag
38  ManualControlStatus Compute(const NavTag* navTag, const PositionOnLivePath& positionOnLivePath);
39  ManualControlStatus Compute(const DynamicNavTag* navTag, const PositionOnLivePath& positionOnLivePath);
40 
41 private:
42  ManualControlStatus GetStatus(const PositionOnLivePath& positionOnLivePath) const;
43 
44  // Move to NavTag Entry
45  // if already on the NavTag it will give the entry of the _current_ EventInterval that is backward from positionOnLivePath!
46  // if not on the NavTag it will give the entry of the _next_ EventInterval that is forward from positionOnLivePath!
47  template<class TNavTag> void MovePositionOnPathToCurrentOrNextNavTagEntry(const TNavTag* navTag, PositionOnLivePath& positionOnLivePath);
48 
49  // Move to NavTag Exit
50  // if already on the NavTag it will give the exit of the _current_ EventInterval that is forward from positionOnLivePath!
51  // if not on the NavTag it will give the exit of the _previous_ EventInterval that is backward from positionOnLivePath!
52  template<class TNavTag> void MovePositionOnPathToCurrentOrPreviousNavTagExit(const TNavTag* navTag, PositionOnLivePath& positionOnLivePath);
53 
54  // Find the ManualControl entry and exit points based on the given NavTag
55  // if m_progressOnLivePath already on the NavTag, it gives the previous entry and current exit
56  // if m_progressOnLivePath not on the NavTag, it gives the next entry and next exit
57  // Beware that ManualControlInterval should not be kept over several frames.
58  template<class TNavTag> ManualControlStatus GetCurrentOrNextManualControlInterval(const TNavTag* navTag, const PositionOnLivePath& positionOnLivePath);
59 
60 public: // internal
61  ManualControlInterval() : m_pathValidityInterval(KY_NULL) {}
62  void BindToPathValdityInterval(PathValidityInterval* pathValidityInterval);
63 
64  ManualControlStatus GetEnterStatus() const { return GetStatus(m_enterPos); }
65  ManualControlStatus GetExitStatus() const;
66 
67  // Be sure to check GetEnterStatus() and GetExitStatus() first
68  const PositionOnLivePath& GetEnterPositionOnLivePath() const { return m_enterPos; }
69  const PositionOnLivePath& GetExitPositionOnLivePath() const { return m_exitPos; }
70  const PositionOnPath& GetEnterPositionOnPath() const { return m_enterPos.GetPositionOnPath(); }
71  const PositionOnPath& GetExitPositionOnPath() const { return m_exitPos.GetPositionOnPath(); }
72  const Vec3f& GetEnterPosition() const { return m_enterPos.GetPosition(); }
73  const Vec3f& GetExitPosition() const { return m_exitPos.GetPosition(); }
74 
75  void Clear()
76  {
77  m_enterPos.Clear();
78  m_exitPos.Clear();
79  }
80 
81  // event information are invalidated, but PositionOnPath are maintained
82  void ClearEventListLocation()
83  {
84  m_enterPos.ClearEventListLocation();
85  m_exitPos.ClearEventListLocation();
86  }
87 
88  void FindLocationOnEventListFromScratch();
89 
90  // Should be called only if ExitPosition was pending by the PathProgressComputer
91  void UpdatePendingExitPosition();
92 
93 
94 public: // internal
95  PathValidityInterval* m_pathValidityInterval;
96  PositionOnLivePath m_enterPos;
97  PositionOnLivePath m_exitPos;
98 };
99 
100 }
101 
102 #endif
PositionOnPath is valid, but event information in PositionOnLivePath are not valid.
Definition: manualcontrolinterval.h:22
binded to a bot, but PositionPath is invalid
Definition: manualcontrolinterval.h:21
PositionOnLivePath needs validation, PositionOnPath and event information can change! ...
Definition: manualcontrolinterval.h:23
#define KY_NULL
Null value.
Definition: types.h:247
PositionOnLivePath is valid.
Definition: manualcontrolinterval.h:24
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
Definition: gamekitcrowddispersion.h:20
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
ManualControlStatus
Definition: manualcontrolinterval.h:18
not initialized
Definition: manualcontrolinterval.h:20