gwnavruntime/pathfollower/manualcontrolinterval.h Source File

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