gwnavruntime/queries/utils/basediskcangoquery.h Source File

basediskcangoquery.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 
30 };
31 
35 {
39 
51 };
52 
53 
56 {
57 public:
58  static QueryType GetStaticType() { return TypeDiskCanGo; }
59  static Ptr<BaseBlobHandler> CreateStaticQueryBlobHandler();
60 
61  virtual QueryType GetType() const { return TypeDiskCanGo; }
62  virtual void BuildQueryBlob(BaseBlobHandler* blobHandler);
63  virtual void InitFromQueryBlob(World* world, void* blob);
64  virtual Ptr<BaseBlobHandler> CreateQueryBlobHandler() { return CreateStaticQueryBlobHandler(); }
65 
66  // ------------------------------ BindToDatabase ------------------------------
67 
69  void BindToDatabase(Database* database);
70 
71  // ------------------------------ input setters -----------------------------
72 
74  void Initialize(const Vec3f& startPos, const Vec3f& destPos, KyFloat32 radius);
75 
76  void SetStartTrianglePtr(const NavTrianglePtr& startTrianglePtr) { m_startTrianglePtr = startTrianglePtr; }
77  void SetDestTrianglePtr(const NavTrianglePtr& destTrianglePtr) { m_destTrianglePtr = destTrianglePtr; }
78  void SetQueryDynamicOutput(QueryDynamicOutput* queryDynamicOutput) { m_queryDynamicOutput = queryDynamicOutput; }
79 
80  void SetStartIntegerPos(const WorldIntegerPos& startIntegerPos) { m_startIntegerPos = startIntegerPos; }
81  void SetDestIntegerPos(const WorldIntegerPos& destIntegerPos) { m_destIntegerPos = destIntegerPos; }
82 
83  // ------------------------------ configuration setters ------------------------------
84 
86  void SetDynamicOutputMode(DynamicOutputMode dynamicOutputMode) { m_dynamicOutputMode = dynamicOutputMode; }
87 
88  void SetQueryType(DiskCanGoQueryType queryType) { m_queryType = queryType; }
89 
90  // ------------------------------ results getter -----------------------------
91 
92  DiskCanGoQueryResult GetResult() const { return m_result; }
93  QueryDynamicOutput* GetQueryDynamicOutput() const { return m_queryDynamicOutput; }
94 
95  // ------------------------------ inputs getters -----------------------------
96 
97  const Vec3f& GetStartPos() const { return m_startPos3f; }
98  const Vec3f& GetDestPos() const { return m_destPos3f; }
99 
100  const NavTrianglePtr& GetStartTrianglePtr() const { return m_startTrianglePtr; }
101  const NavTrianglePtr& GetDestTrianglePtr() const { return m_destTrianglePtr; }
102 
103  WorldIntegerPos GetStartIntegerPos() const { return m_startIntegerPos; }
104  WorldIntegerPos GetDestIntegerPos() const { return m_destIntegerPos; }
105 
106  KyFloat32 GetRadius() const { return m_radius; }
107  DiskCanGoQueryType GetQueryType() const { return m_queryType; }
108 
109  // ------------------------------ configuration getters ------------------------------
110 
111  DynamicOutputMode GetDynamicOutputMode() const { return m_dynamicOutputMode; }
112  const PositionSpatializationRange& GetPositionSpatializationRange() const { return m_positionSpatializationRange; }
113 
114 protected:
115  BaseDiskCanGoQuery();
116  virtual ~BaseDiskCanGoQuery() {}
117  void SetResult(DiskCanGoQueryResult result) { m_result = result; }
118  DiskCanGoQueryResult ConvertRayCanGoResultToDiskCanGoResult(RayCanGoQueryResult result);
119  DiskCanGoQueryResult ConvertTraversalResultToDiskCanGoResult(TraversalResult traversalRC);
120 
121 protected:
122  // ------------------------------ inputs -----------------------------
123  // inputs members are cleared by BindToDatabase() and Initialize().
124 
127  WorldIntegerPos m_startIntegerPos;
128 
131  WorldIntegerPos m_destIntegerPos;
132 
134 
135  // ------------------------------ configuration -----------------------------
136  // configuration members are cleared by BindToDatabase() but not by Initialize().
137 
141 
145 
149 
150  // ------------------------------ results -----------------------------
151  // results members are cleared by BindToDatabase() and Initialize().
152 
155 
160  Ptr<QueryDynamicOutput> m_queryDynamicOutput;
161 };
162 
163 }
DiskCanGoQueryResult m_result
Set to DISKCANGO_NOT_PROCESSED in Initialize().
Definition: basediskcangoquery.h:154
Indicates that a NavMesh triangle has been found for the starting point, but its NavTag is not consid...
Definition: basediskcangoquery.h:23
This class gather the data encountered along some query process.
Definition: querydynamicoutput.h:57
Indicates the query generated no results, which may indicate that the start and end points are on dif...
Definition: basediskcangoquery.h:25
Indicates the query has not yet been launched.
Definition: basediskcangoquery.h:20
Vertical range (above, below) that represents the altitude tolerance for a position to be inside the ...
Definition: positionspatializationrange.h:17
Base class for DiskCanGoQuery.
Definition: basediskcangoquery.h:55
NavTrianglePtr m_startTrianglePtr
If no m_startTrianglePtr is set, it will be automatically computed from m_startPos3f. Cleared by Initialize().
Definition: basediskcangoquery.h:126
Base class for all the queries that do not need to be time-sliced.
Definition: iquery.h:245
DiskCanGoQueryType
Enumerates the possible behaviors of a BaseDiskCanGoQuery when the the starting point lies inside the...
Definition: basediskcangoquery.h:34
DynamicOutputMode m_dynamicOutputMode
What type of data to collect and store in m_queryDynamicOutput.
Definition: basediskcangoquery.h:144
void SetDynamicOutputMode(DynamicOutputMode dynamicOutputMode)
What type of data to collect and store in m_queryDynamicOutput.
Definition: basediskcangoquery.h:86
Indicates the query has not yet been initialized.
Definition: basediskcangoquery.h:19
NavTrianglePtr m_destTrianglePtr
If no m_destTrianglePtr is set, it will be automatically computed from m_destPos3f. Cleared by Initialize().
Definition: basediskcangoquery.h:130
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 a NavMesh triangle could not be found for the starting point.
Definition: basediskcangoquery.h:22
KyFloat32 m_radius
The radius of the disk. Set by Initialize().
Definition: basediskcangoquery.h:133
DiskCanGoQueryType m_queryType
Specifies how it behaves when the start disk cannot fit the navmesh.
Definition: basediskcangoquery.h:148
DiskCanGoQueryResult
Enumerates the possible results of a DiskCanGoQuery.
Definition: basediskcangoquery.h:17
QueryType
Enumerates all the type of query.
Definition: iquery.h:25
virtual QueryType GetType() const
Get query type.
Definition: basediskcangoquery.h:61
Vec3f m_destPos3f
The destination position. Set by Initialize().
Definition: basediskcangoquery.h:129
void SetStartTrianglePtr(const NavTrianglePtr &startTrianglePtr)
If no m_startTrianglePtr is set, it will be automatically computed from m_startPos3f. Cleared by Initialize().
Definition: basediskcangoquery.h:76
Indicates that the disk can pass in a straight line-from start to end point-without a collision...
Definition: basediskcangoquery.h:29
Indicates that the query will detect a collision when the the starting point lies inside the NavMesh ...
Definition: basediskcangoquery.h:38
Vec3f m_startPos3f
The start position. Set by Initialize().
Definition: basediskcangoquery.h:125
void SetQueryType(DiskCanGoQueryType queryType)
Specifies how it behaves when the start disk cannot fit the navmesh.
Definition: basediskcangoquery.h:88
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
void SetPositionSpatializationRange(const PositionSpatializationRange &range)
range to compute trianglePtr from position.
Definition: basediskcangoquery.h:85
Indicates that the query has not yet been initialized.
Definition: iquery.h:295
PositionSpatializationRange m_positionSpatializationRange
range to compute trianglePtr from position.
Definition: basediskcangoquery.h:140
void SetDestTrianglePtr(const NavTrianglePtr &destTrianglePtr)
If no m_destTrianglePtr is set, it will be automatically computed from m_destPos3f. Cleared by Initialize().
Definition: basediskcangoquery.h:77
Utilities for dealing with NavData coordinates, which are expressed in a world space based on integer...
Definition: worldintegerpos.h:19
Indicates that a collision was detected along the straight line between the starting and ending point...
Definition: basediskcangoquery.h:24
void BindToDatabase(Database *database)
Binds the query with database, clears inputs and results, sets the configuration to defaults...
Definition: basediskcangoquery.cpp:45
Each instance of this class uniquely identifies a single NavTriangle in a NavFloor.
Definition: navtriangleptr.h:17
void SetQueryDynamicOutput(QueryDynamicOutput *queryDynamicOutput)
Will receive and store the dynamic data collected during the query process.
Definition: basediskcangoquery.h:78
Indicates that an unknown error occurred during the query processing.
Definition: basediskcangoquery.h:27
Indicates that the query has not yet been launched.
Definition: iquery.h:296
If the center of the disk lies near a boundary of the NavMesh, the query will try to avoid a collisio...
Definition: basediskcangoquery.h:50
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
RayCanGoQueryResult
Enumerates the possible results of a RayCanGoQuery.
Definition: baseraycangoquery.h:24
float KyFloat32
float
Definition: types.h:32
3d vector using 32bits floating points.
Definition: vec3f.h:16
Indicates that insufficient working memory caused the query to stop.
Definition: basediskcangoquery.h:26
Ptr< QueryDynamicOutput > m_queryDynamicOutput
Will receive and store the dynamic data collected during the query process.
Definition: basediskcangoquery.h:160