gwnavruntime/queries/utils/basepathfrompolylinequery.h Source File

basepathfrompolylinequery.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 
15 
16 namespace Kaim
17 {
18 
19 class Path;
20 
21 
24 {
27 
33 
45 
48 };
49 
50 
53 {
54 public:
55  static QueryType GetStaticType() { return TypePathFromPolyline; }
56  virtual QueryType GetType() const { return TypePathFromPolyline; }
57 
58  // ---------------------------------- Main API functions ----------------------------------
59 
60  virtual void GetPathFinderTextResult(String&) const;
61  virtual PathFinderResult GetPathFinderResult() const;
62  virtual const Vec3f* GetDestination() const;
63 
64  PathFromPolylineQueryResult GetResult() const;
65  const Vec3f& GetStartPos() const;
66  const KyArrayPOD<Vec3f>& GetPolyline() const;
67  PathFinderQueryComputeChannelMode GetComputeChannelMode() const;
68  const ChannelComputerConfig& GetChannelComputerConfig() const;
69  Path* GetPath() const;
70  ChannelArray* GetChannelArray() const;
71  KyUInt32 GetNumberOfProcessedNodePerFrame() const;
72 
73  const PositionSpatializationRange& GetPositionSpatializationRange() const;
74 
75 public: // internal
76  void BindToDatabase(Database* database);
77  void Initialize(const Vec3f* vertexBuffer, KyUInt32 vertexCount);
78 
79  void SetComputeChannelMode(PathFinderQueryComputeChannelMode computeChannelMode);
80  void SetChannelComputerConfig(const ChannelComputerConfig& channelComputerConfig);
81  void SetPositionSpatializationRange(const PositionSpatializationRange& positionSpatializationRange);
82 
83  void SetPathClamperFlagMask(PathClamperFlagMask pathClamperFlagMask); // Call this method after BindToDatabase()
84 
85 protected:
87  virtual ~BasePathFromPolylineQuery() {}
88  void SetResult(PathFromPolylineQueryResult result);
89 
90 protected:
91  KyArrayPOD<Vec3f> m_polylinePositions;
92 
95 
97 
98  PathClamperFlagMask m_pathClamperFlagMask;
99 
100 public: //internal
103 
106 };
107 
108 
109 KY_INLINE void BasePathFromPolylineQuery::SetResult(PathFromPolylineQueryResult result) { m_result = result; }
110 KY_INLINE void BasePathFromPolylineQuery::SetComputeChannelMode(PathFinderQueryComputeChannelMode mode) { m_computeChannelMode = mode; }
111 KY_INLINE void BasePathFromPolylineQuery::SetChannelComputerConfig(const ChannelComputerConfig& config) { m_channelComputerConfig = config; }
112 
113 KY_INLINE PathFromPolylineQueryResult BasePathFromPolylineQuery::GetResult() const { return m_result; }
114 KY_INLINE Path* BasePathFromPolylineQuery::GetPath() const { return m_path; }
115 KY_INLINE PathFinderQueryComputeChannelMode BasePathFromPolylineQuery::GetComputeChannelMode() const { return m_computeChannelMode; }
116 KY_INLINE const ChannelComputerConfig& BasePathFromPolylineQuery::GetChannelComputerConfig() const { return m_channelComputerConfig; }
117 KY_INLINE const Vec3f& BasePathFromPolylineQuery::GetStartPos() const { return IPathFinderQuery::GetStartPos(); }
118 KY_INLINE const KyArrayPOD<Vec3f>& BasePathFromPolylineQuery::GetPolyline() const { return m_polylinePositions; }
120 {
121  if (m_polylinePositions.GetCount() == 0)
122  return nullptr;
123 
124  return &m_polylinePositions.Back();
125 }
126 
127 KY_INLINE const PositionSpatializationRange& BasePathFromPolylineQuery::GetPositionSpatializationRange() const { return m_positionSpatializationRange; }
128 KY_INLINE void BasePathFromPolylineQuery::SetPositionSpatializationRange(const PositionSpatializationRange& positionSpatializationRange)
129 {
130  m_positionSpatializationRange = positionSpatializationRange;
131 }
132 
133 KY_INLINE void BasePathFromPolylineQuery::SetPathClamperFlagMask(PathClamperFlagMask pathClamperFlagMask) { m_pathClamperFlagMask = pathClamperFlagMask; }
134 
135 }
136 
137 
General purpose array for movable objects that DOES NOT require construction/destruction.
Definition: kyarray.h:194
ChannelComputerConfig m_channelComputerConfig
The parameter set specific to Channels computation.
Definition: ipathfinderquery.h:86
Base class for all pathfinder queries.
Definition: ipathfinderquery.h:34
Indicates that query starting location and ending location are equals. computing a Path would have le...
Definition: basepathfrompolylinequery.h:46
Indicates that the query has stopped and must be relaunched because of a change in the NavData...
Definition: basepathfrompolylinequery.h:38
Indicates that the clamper is beeing initialized.
Definition: basepathfrompolylinequery.h:28
PathFinderQueryComputeChannelMode
This enum tells if the PathFinderQuery should compute Channels around path sections laying on the Nav...
Definition: ipathfinderquery.h:25
virtual void GetPathFinderTextResult(String &) const
Fills the String with an explanation of the result. Use this to debug your pathfinder query...
Definition: basepathfrompolylinequery.cpp:110
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
Vertical range (above, below) that represents the altitude tolerance for a position to be inside the ...
Definition: positionspatializationrange.h:17
Base class for AstarQuery.
Definition: basepathfrompolylinequery.h:52
PathClamperFlag
These flags determine if some specific positions must have their altitude clamped on NavMesh...
Definition: pathclamperflag.h:15
virtual QueryType GetType() const
Get query type.
Definition: basepathfrompolylinequery.h:56
PathFromPolylineQueryResult
Enumerates the possible results of an PathFromPolylineQuery.
Definition: basepathfrompolylinequery.h:23
Indicates that a computation error caused the query to stop.
Definition: basepathfrompolylinequery.h:40
Class that aggregates parameters that allow to configure the channel computation of a Bot...
Definition: channelcomputerconfig.h:89
PathFromPolylineQueryResult m_result
Updated during processing to indicate the result of the PathFinderQueryResult query.
Definition: basepathfrompolylinequery.h:96
Indicates that the input polyline in empty.
Definition: basepathfrompolylinequery.h:44
This class aggregates Channels along a Path.
Definition: channelarray.h:27
Ptr< Path > m_path
The Path found by the query.
Definition: ipathfinderquery.h:94
Unused. Kept here for backward compatibility.
Definition: basepathfrompolylinequery.h:31
Indicates that a path could not be found between the start and destination points.
Definition: basepathfrompolylinequery.h:37
PathFinderQueryComputeChannelMode m_computeChannelMode
The mode toggling Channels computation.
Definition: ipathfinderquery.h:85
Indicates that the clamping algorithm has completed, but the path has not yet been built...
Definition: basepathfrompolylinequery.h:30
QueryType
Enumerates all the type of query.
Definition: iquery.h:25
KyUInt32 m_numberOfIntersectionTestPerAdvance
The number of intersections that will be processed each frame during the clamper part of the query...
Definition: basepathfrompolylinequery.h:105
This class is a runtime container for all NavData that represents the world from the point of view of...
Definition: database.h:57
KyUInt32 m_numberOfRayCastPerAdavance
The number of CanGo tests that will be processed each frame during the refiner part of the query...
Definition: basepathfrompolylinequery.h:102
PositionSpatializationRange m_positionSpatializationRange
The altitude range used to find NavMesh triangles that correspond to the start and destination points...
Definition: basepathfrompolylinequery.h:94
virtual const Vec3f * GetDestination() const
This function is virtual because not all the PathFinders have a preset destination, it may return nullptr.
Definition: basepathfrompolylinequery.h:119
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
Indicates that a path has been found between the start and destination.
Definition: basepathfrompolylinequery.h:47
Indicates that one of the rayCast along polyline edge failed.
Definition: basepathfrompolylinequery.h:36
Indicates that the query has not yet been initialized.
Definition: iquery.h:295
Indicates that the computation has been canceled.
Definition: basepathfrompolylinequery.h:43
Indicates that the last point of the polyline is outside the NavMesh.
Definition: basepathfrompolylinequery.h:35
PathFinderResult
Enumerates the possible status of a IPathFinderQuery.
Definition: ipathfinderquery.h:38
Indicates that the path is being clamped to navMesh according to the altitude tolerance.
Definition: basepathfrompolylinequery.h:29
Indicates that the provided database is empty (no NavData !)
Definition: basepathfrompolylinequery.h:34
Indicates that the query has not yet been launched.
Definition: iquery.h:296
Indicates the query has not yet been initialized.
Definition: basepathfrompolylinequery.h:25
Indicates the query has not yet been launched.
Definition: basepathfrompolylinequery.h:26
Indicates that a computation error caused the query to stop.
Definition: basepathfrompolylinequery.h:42
Indicates that insufficient working memory caused the query to stop.
Definition: basepathfrompolylinequery.h:39
Indicates that the channel is initialized, the channel is being computed.
Definition: basepathfrompolylinequery.h:32
Indicates that the input channelComputerConfig is invalid.
Definition: basepathfrompolylinequery.h:41
The class representing a path.
Definition: path.h:62
3d vector using 32bits floating points.
Definition: vec3f.h:16