gwnavruntime/queries/moveonnavmeshquery.h Source File

moveonnavmeshquery.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: LAPA - secondary contact: NOBODY
9 #ifndef Navigation_MoveOnNavMeshQuery_H
10 #define Navigation_MoveOnNavMeshQuery_H
11 
21 
22 namespace Kaim
23 {
24 
25 class NavHalfEdgeRawPtr;
26 
27 
29 template<class TraverseLogic>
30 class MoveOnNavMeshQuery : public BaseMoveOnNavMeshQuery
31 {
32 public:
33  // ---------------------------------- Public Member Functions ----------------------------------
34 
35  static QueryType GetStaticType() { return TypeMoveOnNavMesh; }
36  virtual QueryType GetType() const { return TypeMoveOnNavMesh; }
37 
39  virtual ~MoveOnNavMeshQuery() {}
40 
41  // ---------------------------------- Functions to set up the query ----------------------------------
42 
46  void BindToDatabase(Database* database);
47 
54  void Initialize(const Vec3f& startPos, const Vec2f& normalizedDir2d, KyFloat32 maxDist);
55 
56  // ---------------------------------- write accessors for query inputs ----------------------------------
57 
61  void SetStartTrianglePtr(const NavTrianglePtr& startTrianglePtr);
62 
63  // ---------------------------------- write accessors for query parameters ----------------------------------
64 
67  void SetDistanceToBoundary(KyFloat32 distanceToBoundary);
68 
69  // ---------------------------------- Query framework functions ----------------------------------
70 
71  virtual void Advance(WorkingMemory* workingMemory);
72 
76  void PerformQuery(WorkingMemory* workingMemory = KY_NULL);
77 
78  // ---------------------------------- Accessors ----------------------------------
79 
80  MoveOnNavMeshQueryResult GetResult() const;
81  const Vec3f& GetStartPos() const;
82  const Vec3f& GetArrivalPos() const;
83  const Vec2f& GetNormalizedDir2d() const;
84  const NavTrianglePtr& GetStartTrianglePtr() const;
85  KyFloat32 GetDistanceToBoundary() const;
86  KyFloat32 GetDistance() const;
87  KyFloat32 GetAltitudeTolerance() const;
88 
89 public://internal
90  void PerformQueryWithInputCoordPos(WorkingMemory* workingMemory);
91  void SetStartIntegerPos(const WorldIntegerPos& startIntegerPos);
92  const WorldIntegerPos& GetStartIntegerPos() const;
93 
94 private:
95  void SetDefaults();
96  void SetResult(MoveOnNavMeshQueryResult result);
97 
98  bool CollectNearbyNavMeshBorders(WorkingMemory* workingMemory, WorkingMemArray<NavHalfEdgeRawPtr>& nearbyEdges);
99  bool SolveCase(WorkingMemory* workingMemory, const WorkingMemArray<NavHalfEdgeRawPtr>& nearbyEdges);
100 
101 };
102 
103 } // namespace Kaim
104 
106 
107 
108 
109 #endif //Navigation_MoveOnNavMeshQuery_H
110 
void SetDistanceToBoundary(KyFloat32 distanceToBoundary)
Set the minimal distance the arrival position should be from any NavMesh border.
Definition: moveonnavmeshquery.inl:35
#define KY_NULL
Null value.
Definition: types.h:247
QueryType
Enumerates all the type of query.
Definition: iquery.h:29
This class is a runtime container for all NavData that represents the world from the point of view of...
Definition: database.h:64
virtual void Advance(WorkingMemory *workingMemory)
This function is called by the QueryQueue to process one step on the query.
Definition: moveonnavmeshquery.inl:56
This class defines a two-dimensional vector whose coordinates are stored using floating-point numbers...
Definition: vec2f.h:24
void BindToDatabase(Database *database)
Binds the query with the specified Database, clears all the inputs and outputs and sets all other par...
Definition: moveonnavmeshquery.inl:19
Definition: gamekitcrowddispersion.h:20
void PerformQuery(WorkingMemory *workingMemory=0)
Performs the query.
Definition: moveonnavmeshquery.inl:328
MoveOnNavMeshQueryResult
Enumerates the possible results of a MoveOnNavMeshQuery.
Definition: basemoveonnavmeshquery.h:22
Utilities for dealing with NavData coordinates, which are expressed in a world space based on integer...
Definition: worldintegerpos.h:21
Each instance of this class uniquely identifies a single NavTriangle in a NavFloor.
Definition: navtriangleptr.h:22
This class is used to get move bots on the NavMesh without physics engine.
Definition: moveonnavmeshquery.h:30
void SetStartTrianglePtr(const NavTrianglePtr &startTrianglePtr)
Set the NavMesh triangle that corresponds to #m_startPos3f.
Definition: moveonnavmeshquery.inl:31
void Initialize()
Should be called by the derived class before trying to perform the query or to push it in a QueryQueu...
Definition: iquery.h:372
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