gwnavruntime/queries/utils/baseraycangoquery.h Source File

baseraycangoquery.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 
14 
15 namespace Kaim
16 {
17 
18 class NavHalfEdgeRawPtr;
19 class RawNavTagSubSegment;
20 template <class T>
21 class WorkingMemArray;
22 
25 {
28 
37 
39 };
40 
43 {
44 public:
45  static QueryType GetStaticType() { return TypeRayCanGo; }
46  static Ptr<BaseBlobHandler> CreateStaticQueryBlobHandler();
47 
48  virtual QueryType GetType() const { return TypeRayCanGo; }
49  virtual void BuildQueryBlob(BaseBlobHandler* blobHandler);
50  virtual void InitFromQueryBlob(World* world, void* blob);
51  virtual Ptr<BaseBlobHandler> CreateQueryBlobHandler() { return CreateStaticQueryBlobHandler(); }
52 
53  // ------------------------------ BindToDatabase ------------------------------
54 
56  void BindToDatabase(Database* database);
57 
58  // ------------------------------ input setters -----------------------------
59 
61  void Initialize(const Vec3f& startPos, const Vec3f& destPos);
62 
63  void SetStartTrianglePtr(const NavTrianglePtr& startTrianglePtr) { m_startTrianglePtr = startTrianglePtr; }
64  void SetDestTrianglePtr(const NavTrianglePtr& destTrianglePtr) { m_destTrianglePtr = destTrianglePtr; }
65  void SetQueryDynamicOutput(QueryDynamicOutput* queryDynamicOutput) { m_queryDynamicOutput = queryDynamicOutput; }
66 
67  void SetStartIntegerPos(const WorldIntegerPos& startIntegerPos) { m_startIntegerPos = startIntegerPos; }
68  void SetDestIntegerPos(const WorldIntegerPos& destIntegerPos) { m_destIntegerPos = destIntegerPos; }
69 
70  // ------------------------------ configuration setters ------------------------------
71 
73  void SetDynamicOutputMode(DynamicOutputMode dynamicOutputMode) { m_dynamicOutputMode = dynamicOutputMode; }
74 
75  void SetMarginMode(RayCanGoMarginMode marginMode) { m_marginMode = marginMode; }
76  void SetComputeCostMode(ComputeCostMode computeCostMode) { m_computeCostMode = computeCostMode; }
77 
78  // ------------------------------ results getter -----------------------------
79 
80  RayCanGoQueryResult GetResult() const { return m_result; }
81  QueryDynamicOutput* GetQueryDynamicOutput() const { return m_queryDynamicOutput; }
82 
83  KyFloat32 GetComputedCost() const { return m_cost; }
84 
85  // ------------------------------ inputs getters -----------------------------
86 
87  const Vec3f& GetStartPos() const { return m_startPos3f; }
88  const Vec3f& GetDestPos() const { return m_destPos3f; }
89 
90  const NavTrianglePtr& GetStartTrianglePtr() const { return m_startTrianglePtr; }
91  const NavTrianglePtr& GetDestTrianglePtr() const { return m_destTrianglePtr; }
92 
93  WorldIntegerPos GetStartIntegerPos() const { return m_startIntegerPos; }
94  WorldIntegerPos GetDestIntegerPos() const { return m_destIntegerPos; }
95 
96  // ------------------------------ configuration getters ------------------------------
97 
98  DynamicOutputMode GetDynamicOutputMode() const { return m_dynamicOutputMode; }
99  const PositionSpatializationRange& GetPositionSpatializationRange() const { return m_positionSpatializationRange; }
100 
101  ComputeCostMode GetComputeCostMode() const { return m_computeCostMode; }
102  RayCanGoMarginMode GetMarginMode() const { return m_marginMode; }
103 
104 protected:
105  BaseRayCanGoQuery();
106  virtual ~BaseRayCanGoQuery() {}
107  void SetResult(RayCanGoQueryResult result) { m_result = result; }
108  void RayCanGo_NoHit(const NavHalfEdgeRawPtr& lastHalfEdgeRawPtr, CompositeSubSegment& subSegment, ScopedDynamicOutput& scopedDynamicOutput);
109 
110 protected:
111  // ------------------------------ inputs -----------------------------
112  // inputs members are cleared by BindToDatabase() and Initialize().
113 
116  WorldIntegerPos m_startIntegerPos;
117 
120  WorldIntegerPos m_destIntegerPos;
121 
122  // ------------------------------ configuration -----------------------------
123  // configuration members are cleared by BindToDatabase() but not by Initialize().
124 
128 
132 
135 
139 
140  // ------------------------------ results -----------------------------
141  // results members are cleared by BindToDatabase() and Initialize().
142 
145 
148 
153  Ptr<QueryDynamicOutput> m_queryDynamicOutput;
154 };
155 
156 }
void SetStartTrianglePtr(const NavTrianglePtr &startTrianglePtr)
If no m_startTrianglePtr is set, it will be automatically computed from m_startPos3f. Cleared by Initialize().
Definition: baseraycangoquery.h:63
This class gather the data encountered along some query process.
Definition: querydynamicoutput.h:57
NavTrianglePtr m_destTrianglePtr
If no m_destTrianglePtr is set, it will be automatically computed from m_destPos3f. Cleared by Initialize().
Definition: baseraycangoquery.h:119
void SetDynamicOutputMode(DynamicOutputMode dynamicOutputMode)
What type of data to collect and store in m_queryDynamicOutput.
Definition: baseraycangoquery.h:73
Indicates that a collision was detected along the straight line between the starting and ending point...
Definition: baseraycangoquery.h:31
Indicates that the query has not yet been launched.
Definition: baseraycangoquery.h:27
Vertical range (above, below) that represents the altitude tolerance for a position to be inside the ...
Definition: positionspatializationrange.h:17
virtual QueryType GetType() const
Get query type.
Definition: baseraycangoquery.h:48
void SetComputeCostMode(ComputeCostMode computeCostMode)
Determines whether or not the query computes the approximate cost of following the line segment...
Definition: baseraycangoquery.h:76
Indicates that an unknown error occurred during the query processing.
Definition: baseraycangoquery.h:36
Base class for all the queries that do not need to be time-sliced.
Definition: iquery.h:245
PositionSpatializationRange m_positionSpatializationRange
range to compute trianglePtr from position.
Definition: baseraycangoquery.h:127
Indicates that none of the above results occurred, which may indicate that the start and end points l...
Definition: baseraycangoquery.h:34
void BindToDatabase(Database *database)
Binds the query with database, clears inputs and results, sets the configuration to defaults...
Definition: baseraycangoquery.cpp:53
void SetMarginMode(RayCanGoMarginMode marginMode)
The margin mode to be used in this query to eventually ensure the ray is not too close to any NavMesh...
Definition: baseraycangoquery.h:75
Indicates that the ray can pass in a straight line from the starting point to the ending point withou...
Definition: baseraycangoquery.h:38
Indicates that a border was detected close (less than margin) to the straight line between the starti...
Definition: baseraycangoquery.h:33
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
NavTrianglePtr m_startTrianglePtr
If no m_startTrianglePtr is set, it will be automatically computed from m_startPos3f. Cleared by Initialize().
Definition: baseraycangoquery.h:115
KyFloat32 m_cost
Updated during processing to store the cost of the line segment, if enabled by m_computeCostMode.
Definition: baseraycangoquery.h:147
QueryType
Enumerates all the type of query.
Definition: iquery.h:25
Indicates that insufficient memory was available to store crossed triangles or sub-sections, and the query failed as a result.
Definition: baseraycangoquery.h:35
ComputeCostMode
Enumerates the possible ways a RayCanGoQuery can compute the cost of following the ray...
Definition: rayqueryutils.h:33
RayCanGoMarginMode
Defines the different mode for the NavMesh border margin to be used in RayCanGo queries.
Definition: database.h:37
Ptr< QueryDynamicOutput > m_queryDynamicOutput
Will receive and store the dynamic data collected during the query process.
Definition: baseraycangoquery.h:153
RayCanGoQueryResult m_result
Set to RAYCANGO_NOT_PROCESSED in Initialize().
Definition: baseraycangoquery.h:144
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
Vec3f m_startPos3f
The start position. Set by Initialize().
Definition: baseraycangoquery.h:114
void SetQueryDynamicOutput(QueryDynamicOutput *queryDynamicOutput)
Will receive and store the dynamic data collected during the query process.
Definition: baseraycangoquery.h:65
Indicates that the query has not yet been initialized.
Definition: iquery.h:295
Indicates that a NavMesh triangle could not be found for the starting point.
Definition: baseraycangoquery.h:29
DynamicOutputMode m_dynamicOutputMode
What type of data to collect and store in m_queryDynamicOutput.
Definition: baseraycangoquery.h:131
Utilities for dealing with NavData coordinates, which are expressed in a world space based on integer...
Definition: worldintegerpos.h:19
Vec3f m_destPos3f
The destination position. Set by Initialize().
Definition: baseraycangoquery.h:118
Base class for RayCanGoQuery.
Definition: baseraycangoquery.h:42
void SetDestTrianglePtr(const NavTrianglePtr &destTrianglePtr)
If no m_destTrianglePtr is set, it will be automatically computed from m_destPos3f. Cleared by Initialize().
Definition: baseraycangoquery.h:64
Indicates that a NavMesh triangle has been found for the starting point, but its NavTag is not consid...
Definition: baseraycangoquery.h:30
RayCanGoMarginMode m_marginMode
The margin mode to be used in this query to eventually ensure the ray is not too close to any NavMesh...
Definition: baseraycangoquery.h:134
Each instance of this class uniquely identifies a single NavTriangle in a NavFloor.
Definition: navtriangleptr.h:17
Indicates that the query has not yet been initialized.
Definition: baseraycangoquery.h:26
Indicates that the query has not yet been launched.
Definition: iquery.h:296
void SetPositionSpatializationRange(const PositionSpatializationRange &range)
range to compute trianglePtr from position.
Definition: baseraycangoquery.h:72
ComputeCostMode m_computeCostMode
Determines whether or not the query computes the approximate cost of following the line segment...
Definition: baseraycangoquery.h:138
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