gwnavruntime/queries/utils/basemoveonnavmeshquery.h Source File

basemoveonnavmeshquery.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 #pragma once
8 
12 
13 namespace Kaim
14 {
15 
18 {
21 
28 
32 };
33 
34 class BaseMoveOnNavMeshQuery : public IAtomicQuery
35 {
36 public:
37  static QueryType GetStaticType() { return TypeMoveOnNavMesh; }
38  virtual QueryType GetType() const { return TypeMoveOnNavMesh; }
39 
40  // ---------------------------------- Main API Functions ----------------------------------
41 
42  MoveOnNavMeshQueryResult GetResult() const { return m_result; }
43 
44  const Vec3f& GetStartPos() const { return m_startPos3f; }
45 
46  const Vec3f& GetArrivalPos() const { return m_arrivalPos3f; }
47 
48  const Vec2f& GetNormalizedDir2d() const { return m_normalizedDir2d; }
49 
50  const NavTrianglePtr& GetStartTrianglePtr() const { return m_startTrianglePtr; }
51 
52  KyFloat32 GetDistanceToBoundary() const { return m_distanceToBoundary; }
53 
54  KyFloat32 GetDistance() const { return m_moveDistance; }
55 
56  const WorldIntegerPos& GetStartIntegerPos() const { return m_startIntegerPos; }
57 
58 public: // internal
59  void BindToDatabase(Database* database);
60 
61  void Initialize(const Vec3f& startPos, const Vec2f& normalizedDir2d, KyFloat32 maxDist);
62 
63  void SetStartTrianglePtr(const NavTrianglePtr& startTrianglePtr) { m_startTrianglePtr = startTrianglePtr; }
64 
65  void SetDistanceToBoundary(KyFloat32 distanceToBoundary); // Must be called after BindToDatabase were called for the given value to be clamped at half of pixelSize.
66 
67  void SetStartIntegerPos(const WorldIntegerPos& startIntegerPos) { m_startIntegerPos = startIntegerPos; }
68 
69  static KyFloat32 CapDistanceToBoundary(Kaim::Database* database, KyFloat32 distanceToBoundary); // Use by SetDistanceToBoundary and for tests
70 
71 protected:
72  BaseMoveOnNavMeshQuery();
73  virtual ~BaseMoveOnNavMeshQuery() {}
74 
75  void SetResult(MoveOnNavMeshQueryResult result) { m_result = result; }
76 
77 protected:
78  WorldIntegerPos m_startIntegerPos;
79 
80  Vec3f m_startPos3f;
81  Vec2f m_normalizedDir2d;
82 
83  NavTrianglePtr m_startTrianglePtr;
84 
87  KyFloat32 m_distanceToBoundary;
88 
92  KyFloat32 m_moveDistance;
93 
98  Vec3f m_arrivalPos3f;
99 
100  MoveOnNavMeshQueryResult m_result;
101 
102 public:
103  bool m_visualDebugActivated;
104 };
105 }
Indicates that the start position is near an edge but should not be linked to it. ...
Definition: basemoveonnavmeshquery.h:24
Indicates that a NavMesh triangle could not be found for the starting point.
Definition: basemoveonnavmeshquery.h:22
Indicates that the query has not yet been launched.
Definition: basemoveonnavmeshquery.h:20
Indicates that a NavMesh triangle has been found for the starting point, but its NavTag is not consid...
Definition: basemoveonnavmeshquery.h:23
Indicates an arrival point was successfully calculated without a collision with the NavMesh border...
Definition: basemoveonnavmeshquery.h:29
QueryType
Enumerates all the type of query.
Definition: iquery.h:25
Indicates that an unknown error occurred during the query processing.
Definition: basemoveonnavmeshquery.h:27
This class is a runtime container for all NavData that represents the world from the point of view of...
Definition: database.h:57
Indicates a collision point was found, and a final arrival position was successfully calculated...
Definition: basemoveonnavmeshquery.h:30
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
Indicates that insufficient memory was available to store crossed triangles or sub-sections, and the query failed as a result.
Definition: basemoveonnavmeshquery.h:26
MoveOnNavMeshQueryResult
Enumerates the possible results of a MoveOnNavMeshQuery.
Definition: basemoveonnavmeshquery.h:17
Indicates that the query has not yet been initialized.
Definition: iquery.h:295
Indicates a collision point was found, an intermediary position has be found but progression has been...
Definition: basemoveonnavmeshquery.h:31
Indicates that the query has not yet been initialized.
Definition: basemoveonnavmeshquery.h:19
Indicates that the query has not yet been launched.
Definition: iquery.h:296
void Initialize()
Should be called by the derived class prior to perform the query or to push it in a QueryQueue...
Definition: iquery.h:220
float KyFloat32
float
Definition: types.h:32