gwnavruntime/queries/utils/basediskcastquery.h Source File

basediskcastquery.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 
10 
13 
16 
17 namespace Kaim
18 {
19 
20 class NavTriangleRawPtr;
21 
24 {
27 
34 
38 };
39 
40 
44 {
48 
60 };
61 
64 {
65 public:
66  static QueryType GetStaticType() { return TypeDiskCast; }
67  virtual QueryType GetType() const { return TypeDiskCast; }
68  virtual void BuildQueryBlob(BaseBlobHandler* blobHandler);
69  virtual void InitFromQueryBlob(World* world, void* blob);
70  virtual Ptr<BaseBlobHandler> CreateQueryBlobHandler() { return CreateStaticQueryBlobHandler(); }
71  static Ptr<BaseBlobHandler> CreateStaticQueryBlobHandler();
72 
73 
74  // ---------------------------------- Main API Functions ----------------------------------
75 
76  DiskCastQueryResult GetResult() const;
77  const Vec3f& GetStartPos() const;
78  const Vec3f& GetCollisionPos() const;
79  const Vec3f& GetArrivalPos() const;
80  const Vec2f& GetNormalizedDir2d() const;
81  const NavTrianglePtr& GetStartTrianglePtr() const;
82  const NavTrianglePtr& GetArrivalTrianglePtr() const;
83  const NavHalfEdgePtr& GetCollisionNavHalfEdgePtr() const;
84  KyFloat32 GetRadius() const;
85  KyFloat32 GetMaxDist() const;
86  KyFloat32 GetSafetyDist() const;
87  DiskCastQueryType GetQueryType() const;
88  DynamicOutputMode GetDynamicOutputMode() const;
89  QueryDynamicOutput* GetQueryDynamicOutput() const;
90  const WorldIntegerPos& GetStartIntegerPos() const;
91  const WorldIntegerPos& GetArrivalIntegerPos() const;
92 
93  const PositionSpatializationRange& GetPositionSpatializationRange() const;
94 
95 protected:
96  BaseDiskCastQuery();
97  virtual ~BaseDiskCastQuery() {}
98 
99  void BindToDatabase(Database* database);
100  void Initialize(const Vec3f& startPos, KyFloat32 radius, const Vec2f& normalizedDir2d, KyFloat32 maxDist);
101 
102  void SetStartTrianglePtr(const NavTrianglePtr& startTrianglePtr);
103  void SetPositionSpatializationRange(const PositionSpatializationRange& positionSpatializationRange);
104  void SetSafetyDist(KyFloat32 safetyDist);
105  void SetQueryType(DiskCastQueryType queryType);
106  void SetDynamicOutputMode(DynamicOutputMode savingMode);
107  void SetQueryDynamicOutput(QueryDynamicOutput* queryDynamicOutput);
108  void SetStartIntegerPos(const WorldIntegerPos& startIntegerPos);
109  void SetResult(DiskCastQueryResult result);
110 
111  DiskCastQueryResult ConvertTraversalResultToDiskCastResult(TraversalResult traversalRC);
112 
113 
114 protected:
115  WorldIntegerPos m_startIntegerPos;
116  WorldIntegerPos m_arrivalIntegerPos;
117 
123 
127 
130 
134 
138 
146 
150 
152 
154 
156 
163  Ptr<QueryDynamicOutput> m_queryDynamicOutput;
164 };
165 
166 }
167 
169 
170 
171 
172 
Vec3f m_arrivalPos3f
Updated during processing to indicate the final position of the disk at the end of the cast: ...
Definition: basediskcastquery.h:145
Indicates that the disk collided before maximum distance and that a final arrival position was calcul...
Definition: basediskcastquery.h:36
Indicates that a NavMesh triangle could not be found for the starting point.
Definition: basediskcastquery.h:28
virtual QueryType GetType() const
Get query type.
Definition: basediskcastquery.h:67
Vec3f m_startPos3f
The start position of the disk.
Definition: basediskcastquery.h:118
Indicates that moving back the collision point resulted in an arrival position that is outside of the...
Definition: basediskcastquery.h:31
Vertical range (above, below) that represents the altitude tolerance for a position to be inside the ...
Definition: positionspatializationrange.h:17
NavTrianglePtr m_arrivalTrianglePtr
Updated during processing to indicate the NavMesh triangle that corresponds to m_arrivalPos3f.
Definition: basediskcastquery.h:149
KyFloat32 m_maxDist
The maximum distance the disk will travel.
Definition: basediskcastquery.h:121
Base class for DiskCastQuery.
Definition: basediskcastquery.h:63
Base class for all the queries that do not need to be time-sliced.
Definition: iquery.h:245
Vec3f m_collisionPos3f
Updated during processing to indicate the position of the collision point between the disk and the Na...
Definition: basediskcastquery.h:137
NavHalfEdgePtr m_collisionHalfEdgePtr
Updated during processing to indicate the triangle edge the disk collided with (if a collision is det...
Definition: basediskcastquery.h:151
PositionSpatializationRange m_positionSpatializationRange
The altitude range around the position uses to determine m_startTrianglePtr from m_startPos3f.
Definition: basediskcastquery.h:129
Ptr< QueryDynamicOutput > m_queryDynamicOutput
A ref-counted Ptr to a QueryDynamicOutput instance, used to store the data encountered during the que...
Definition: basediskcastquery.h:163
This class is a runtime container for Autodesk Navigation WorldElements such as NavData, Bots, BoxObstacles, TagVolumes...
Definition: world.h:52
DynamicOutputMode
Enumerates possible ways of storing collected data by a query in a QueryDynamicOutput object...
Definition: querydynamicoutput.h:21
Indicates that either the disk does not fit in the NavMesh at its start position, or the arrival posi...
Definition: basediskcastquery.h:30
Indicates that the NavTag at the starting point was forbidden.
Definition: basediskcastquery.h:29
Indicates that an unknown error occurred during the query processing.
Definition: basediskcastquery.h:33
KyFloat32 m_radius
The radius of the disk.
Definition: basediskcastquery.h:120
Indicates that insufficient working memory caused the query to stop.
Definition: basediskcastquery.h:32
QueryType
Enumerates all the type of query.
Definition: iquery.h:25
NavTrianglePtr m_startTrianglePtr
The NavMesh triangle that corresponds to m_startPos3f. Can be set as an input, or retrieved as an out...
Definition: basediskcastquery.h:122
2d vector using KyFloat32.
Definition: vec2f.h:18
If the center of the disk lies near a boundary of the NavMesh, the query will try to avoid a collisio...
Definition: basediskcastquery.h:59
Indicates that the disk was able to travel its maximum distance without collision.
Definition: basediskcastquery.h:35
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
DiskCastQueryType m_queryType
An element from the DiskCanGoQueryType enumeration that indicates if a degraded query should be run w...
Definition: basediskcastquery.h:133
DiskCastQueryType
Enumerates the possible behavior of a BaseDiskCastQuery when the the starting point lies inside the N...
Definition: basediskcastquery.h:43
Indicates that the query has not yet been initialized.
Definition: iquery.h:295
Indicates that the query has not yet been launched.
Definition: basediskcastquery.h:26
Vec2f m_normalizedDir2d
A normalized vector representing the direction in which the disk is cast.
Definition: basediskcastquery.h:119
weird name kept for backward compatibility
Definition: basediskcastquery.h:37
Each instance of this class uniquely identifies a single NavHalfEdge in a NavFloor.
Definition: navhalfedgeptr.h:16
Each instance of this class uniquely identifies a single NavTriangle in a NavFloor.
Definition: navtriangleptr.h:17
DynamicOutputMode m_dynamicOutputMode
Specifies the type of data stored in m_queryDynamicOutput.
Definition: basediskcastquery.h:155
Indicates that the query has not yet been launched.
Definition: iquery.h:296
Indicates that the query has not yet been initialized.
Definition: basediskcastquery.h:25
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
Indicates that the query will detect a collision when the the starting point lies inside the NavMesh ...
Definition: basediskcastquery.h:47
DiskCastQueryResult m_result
Updated during processing to indicate the result of the query.
Definition: basediskcastquery.h:153
DiskCastQueryResult
Enumerates the possible results of a DiskCastQuery.
Definition: basediskcastquery.h:23
float KyFloat32
float
Definition: types.h:32
3d vector using 32bits floating points.
Definition: vec3f.h:16
KyFloat32 m_safetyDist
When a collision is detected, the collision point is moved back along m_normalizedDir2d by this dista...
Definition: basediskcastquery.h:126