gwnavruntime/queries/utils/basediskcastquery.h Source File

basediskcastquery.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 // Primary contact: JUBA - secondary contact: NOBODY
8 #ifndef Navigation_BaseDiskCastQuery_H
9 #define Navigation_BaseDiskCastQuery_H
10 
12 
15 
18 
19 namespace Kaim
20 {
21 
22 class NavTriangleRawPtr;
23 
26 {
29 
36 
39 };
40 
41 
45 {
49 
61 };
62 
64 class BaseDiskCastQuery : public IAtomicQuery
65 {
66 public:
67  static QueryType GetStaticType() { return TypeDiskCast; }
68  virtual QueryType GetType() const { return TypeDiskCast; }
69  virtual void BuildQueryBlob(BaseBlobHandler* blobHandler);
70  virtual void InitFromQueryBlob(World* world, void* blob);
71  virtual Ptr<BaseBlobHandler> CreateQueryBlobHandler() { return CreateStaticQueryBlobHandler(); }
72  static Ptr<BaseBlobHandler> CreateStaticQueryBlobHandler();
73 
74 
75  // ---------------------------------- Main API Functions ----------------------------------
76 
77  DiskCastQueryResult GetResult() const;
78  const Vec3f& GetStartPos() const;
79  const Vec3f& GetCollisionPos() const;
80  const Vec3f& GetArrivalPos() const;
81  const Vec2f& GetNormalizedDir2d() const;
82  const NavTrianglePtr& GetStartTrianglePtr() const;
83  const NavTrianglePtr& GetArrivalTrianglePtr() const;
84  const NavHalfEdgePtr& GetCollisionNavHalfEdgePtr() const;
85  KyFloat32 GetRadius() const;
86  KyFloat32 GetMaxDist() const;
87  KyFloat32 GetSafetyDist() const;
88  DiskCastQueryType GetQueryType() const;
89  DynamicOutputMode GetDynamicOutputMode() const;
90  QueryDynamicOutput* GetQueryDynamicOutput() const;
91  const WorldIntegerPos& GetStartIntegerPos() const;
92  const WorldIntegerPos& GetArrivalIntegerPos() const;
93 
94  const PositionSpatializationRange& GetPositionSpatializationRange() const;
95 
96 protected:
97  BaseDiskCastQuery();
98  virtual ~BaseDiskCastQuery() {}
99 
100  void BindToDatabase(Database* database);
101  void Initialize(const Vec3f& startPos, KyFloat32 radius, const Vec2f& normalizedDir2d, KyFloat32 maxDist);
102 
103  void SetStartTrianglePtr(const NavTrianglePtr& startTrianglePtr);
104  void SetPositionSpatializationRange(const PositionSpatializationRange& positionSpatializationRange);
105  void SetSafetyDist(KyFloat32 safetyDist);
106  void SetQueryType(DiskCastQueryType queryType);
107  void SetDynamicOutputMode(DynamicOutputMode savingMode);
108  void SetQueryDynamicOutput(QueryDynamicOutput* queryDynamicOutput);
109  void SetStartIntegerPos(const WorldIntegerPos& startIntegerPos);
110  void SetResult(DiskCastQueryResult result);
111 
112  DiskCastQueryResult ConvertTraversalResultToDiskCastResult(TraversalResult traversalRC);
113 
114 
115 protected:
116  WorldIntegerPos m_startIntegerPos;
117  WorldIntegerPos m_arrivalIntegerPos;
118 
119  Vec3f m_startPos3f;
120  Vec2f m_normalizedDir2d;
123  NavTrianglePtr m_startTrianglePtr;
124 
130  PositionSpatializationRange m_positionSpatializationRange;
135 
151 
153 
157 
164  Ptr<QueryDynamicOutput> m_queryDynamicOutput;
165 };
166 
167 }
168 
170 
171 
172 
173 #endif //Navigation_BaseDiskCastQuery_H
174 
Vec3f m_arrivalPos3f
Updated during processing to indicate the final position of the disk at the end of the cast: ...
Definition: basediskcastquery.h:155
Indicates that a NavMesh triangle could not be found for the starting point.
Definition: basediskcastquery.h:30
Vec3f m_startPos3f
The start position of the disk.
Definition: basediskcastquery.h:128
Indicates that moving back the collision point resulted in an arrival position that is outside of the...
Definition: basediskcastquery.h:33
NavTrianglePtr m_arrivalTrianglePtr
Updated during processing to indicate the NavMesh triangle that corresponds to m_arrivalPos3f.
Definition: basediskcastquery.h:159
KyFloat32 m_maxDist
The maximum distance the disk will travel.
Definition: basediskcastquery.h:131
Base class for DiskCastQuery.
Definition: basediskcastquery.h:66
Base class for all the queries that do not need to be time-sliced.
Definition: iquery.h:289
Vec3f m_collisionPos3f
Updated during processing to indicate the position of the collision point between the disk and the Na...
Definition: basediskcastquery.h:147
NavHalfEdgePtr m_collisionHalfEdgePtr
Updated during processing to indicate the triangle edge the disk collided with (if a collision is det...
Definition: basediskcastquery.h:161
PositionSpatializationRange m_positionSpatializationRange
The altitude range around the position uses to determine m_startTrianglePtr from m_startPos3f.
Definition: basediskcastquery.h:139
Ptr< QueryDynamicOutput > m_queryDynamicOutput
A ref-counted Ptr to a QueryDynamicOutput instance, used to store the data encountered during the que...
Definition: basediskcastquery.h:175
DynamicOutputMode
Enumerates possible ways of storing crossed data from a query in a QueryDynamicOutput object...
Definition: querydynamicoutput.h:26
Indicates that the starting point is too close to a NavMesh border. Either the disk does not fit in t...
Definition: basediskcastquery.h:32
Indicates that the NavTag at the starting point was forbidden.
Definition: basediskcastquery.h:31
Indicates that an unknown error occurred during the query processing.
Definition: basediskcastquery.h:35
KyFloat32 m_radius
The radius of the disk.
Definition: basediskcastquery.h:130
Indicates that insufficient working memory caused the query to stop.
Definition: basediskcastquery.h:34
QueryType
Enumerates all the type of query.
Definition: iquery.h:29
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:132
If the center of the disk lies near a boundary of the NavMesh, the query will try to avoid a collisio...
Definition: basediskcastquery.h:62
Indicates that the disk was able to travel its maximum distance without collision.
Definition: basediskcastquery.h:37
Definition: gamekitcrowddispersion.h:20
DiskCastQueryType m_queryType
An element from the DiskCanGoQueryType enumeration that indicates if a degraded query should be run w...
Definition: basediskcastquery.h:143
DiskCastQueryType
Enumerates the possible behavior of a BaseDiskCastQuery when the the starting point lies inside the N...
Definition: basediskcastquery.h:44
Indicates that the query has not yet been initialized.
Definition: iquery.h:346
Indicates that the query has not yet been launched.
Definition: basediskcastquery.h:28
Vec2f m_normalizedDir2d
A normalized vector representing the direction in which the disk is cast.
Definition: basediskcastquery.h:129
Indicates that a final arrival position was calculated successfully.
Definition: basediskcastquery.h:38
Each instance of this class uniquely identifies a single NavHalfEdge in a NavFloor.
Definition: navhalfedgeptr.h:19
Each instance of this class uniquely identifies a single NavTriangle in a NavFloor.
Definition: navtriangleptr.h:22
DynamicOutputMode m_dynamicOutputMode
Specifies the type of data stored in m_queryDynamicOutput.
Definition: basediskcastquery.h:165
Indicates that the query has not yet been launched.
Definition: iquery.h:347
Indicates that the query has not yet been initialized.
Definition: basediskcastquery.h:27
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
Indicates that the query will detect a collision when the the starting point lies inside the NavMesh ...
Definition: basediskcastquery.h:48
DiskCastQueryResult m_result
Updated during processing to indicate the result of the query.
Definition: basediskcastquery.h:163
DiskCastQueryResult
Enumerates the possible results of a DiskCastQuery.
Definition: basediskcastquery.h:25
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
KyFloat32 m_safetyDist
When a collision is detected, the collision point is moved back along m_normalizedDir2d by this dista...
Definition: basediskcastquery.h:136