gwnavruntime/queries/utils/baseraycastquery.h Source File

baseraycastquery.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 
8 // Primary contact: JUBA - secondary contact: NOBODY
9 #ifndef Navigation_BaseRayCastQuery_H
10 #define Navigation_BaseRayCastQuery_H
11 
12 
19 
20 
21 namespace Kaim
22 {
23 
24 class NavHalfEdgeRawPtr;
25 class RawNavTagSubSegment;
26 template <class T> class WorkingMemArray;
27 
30 {
33 
41 
44 };
45 
48 {
49 public:
50  static QueryType GetStaticType() { return TypeRayCast; }
51  virtual QueryType GetType() const { return TypeRayCast; }
52  virtual void BuildQueryBlob(BaseBlobHandler* blobHandler);
53  virtual void InitFromQueryBlob(World* world, void* blob);
54  virtual Ptr<BaseBlobHandler> CreateQueryBlobHandler() { return CreateStaticQueryBlobHandler(); }
55  static Ptr<BaseBlobHandler> CreateStaticQueryBlobHandler();
56 
57 
58  // ---------------------------------- Main API Functions ----------------------------------
59 
60  RayCastQueryResult GetResult() const;
61  const Vec3f& GetStartPos() const;
62  const Vec3f& GetCollisionPos() const;
63  const Vec3f& GetArrivalPos() const;
64  const Vec2f& GetMaxMove2D() const;
65  const NavTrianglePtr& GetStartTrianglePtr() const;
66  const NavTrianglePtr& GetArrivalTrianglePtr() const;
67  const NavHalfEdgePtr& GetCollisionNavHalfEdgePtr() const;
68  DynamicOutputMode GetDynamicOutputMode() const;
69  QueryDynamicOutput* GetQueryDynamicOutput() const;
70  const WorldIntegerPos& GetStartIntegerPos() const;
71  const WorldIntegerPos& GetArrivalIntegerPos() const;
72 
73  const PositionSpatializationRange& GetPositionSpatializationRange() const;
74 
75  static CoordPos64 ResolveCollisionPointWhenPointsAreAligned(const CoordPos64& edgeStartPos, const CoordPos64& edgeEndPos, const CoordPos64& startCoordPos64, const CoordPos64& destCoordPos64);
76 public: //Internal
78  virtual ~BaseRayCastQuery() {}
79 
80  void BindToDatabase(Database* database);
81  void Initialize(const Vec3f& startPos, const Vec2f& maxMove2D);
82 
83  void SetStartTrianglePtr(const NavTrianglePtr& startTrianglePtr);
84  void SetPositionSpatializationRange(const PositionSpatializationRange& positionSpatializationRange);
85  void SetDynamicOutputMode(DynamicOutputMode dynamicOutputMode);
86  void SetQueryDynamicOutput(QueryDynamicOutput* queryDynamicOutput);
87  void SetStartIntegerPos(const WorldIntegerPos& startIntegerPos);
88  void SetResult(RayCastQueryResult result);
89 
90 protected:
91  void RayCast_NoHit(const NavHalfEdgeRawPtr& lastHalfEdgeRawPtr, const WorldIntegerPos& destIntegerPos, const Vec3f& destPos3f,
92  CompositeSubSegment& subSegment, ScopedDynamicOutput& scopedDynamicOutput);
93 
94  KyResult ComputeCollisionPosition(const NavHalfEdgeRawPtr& halfEdgeIdRawPtrHit, const CoordPos64& startCoordPos64, const CoordPos64& destCoordPos64,
95  CoordPos64& collisionCoordPos64, Vec3f& edgeStartPos3f, Vec3f& edgeEndPos3f, Vec3f& edgeThirdPos3f);
96 protected:
97  WorldIntegerPos m_startIntegerPos;
98  WorldIntegerPos m_arrivalIntegerPos;
99 
102 
114 
117 
119  PositionSpatializationRange m_positionSpatializationRange;
120 
124 
127 
129 
131 
138  Ptr<QueryDynamicOutput> m_queryDynamicOutput;
139 };
140 
141 }
142 
144 
145 
146 
147 #endif //Navigation_BaseRayCastQuery_H
148 
Indicates that the query has not yet been initialized.
Definition: baseraycastquery.h:31
This class gather the data encountered along some query process.
Definition: querydynamicoutput.h:61
Ptr< QueryDynamicOutput > m_queryDynamicOutput
A ref-counted Ptr to a QueryDynamicOutput instance, used to store the data encountered during the que...
Definition: baseraycastquery.h:149
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
Indicates that a NavMesh triangle has been found for the starting point, but its NavTag is not consid...
Definition: baseraycastquery.h:35
Vec3f m_arrivalPos3f
Updated during processing to indicate the final position of the ray at the end of the cast...
Definition: baseraycastquery.h:115
Indicates that an unknown error occurred during the query processing.
Definition: baseraycastquery.h:40
Vec3f m_startPos3f
The starting point of the line segment to be tested.
Definition: baseraycastquery.h:108
PositionSpatializationRange m_positionSpatializationRange
The altitude range around the position to use when determining m_startTrianglePtr from the m_startPos...
Definition: baseraycastquery.h:128
Base class for all the queries that do not need to be time-sliced.
Definition: iquery.h:289
NavTrianglePtr m_startTrianglePtr
The NavMesh triangle that corresponds to m_startPos3f. You can set it as an input or retrieve it as a...
Definition: baseraycastquery.h:125
Indicates that the query was not performed, because the value of BaseRayCastQuery::m_maxDist is large...
Definition: baseraycastquery.h:39
Indicates that insufficient memory was available to store crossed triangles or sub-sections, and the query failed as a result.
Definition: baseraycastquery.h:38
Vec2f m_maxMove2D
A vector that represents the direction and the maximum distance the ray will travel.
Definition: baseraycastquery.h:122
This class is a runtime container for Gameware Navigation WorldElements such as NavData, Bots, BoxObstacles, TagVolumes...
Definition: world.h:54
NavHalfEdgePtr m_collisionHalfEdgePtr
If a collision has been detected, this is updated to indicate the triangle edge that the ray collided...
Definition: baseraycastquery.h:135
This class defines a two-dimensional vector whose coordinates are stored using 64-bit integers...
Definition: vec2ll.h:27
DynamicOutputMode
Enumerates possible ways of storing crossed data from a query in a QueryDynamicOutput object...
Definition: querydynamicoutput.h:26
Indicates that the ray was able to travel its maximum distance without collision. ...
Definition: baseraycastquery.h:42
RayCastQueryResult
Enumerates the possible results of a RayCastQuery.
Definition: baseraycastquery.h:29
QueryType
Enumerates all the type of query.
Definition: iquery.h:29
Indicates that a collision point was found, but moving back from that point resulted in an arrival po...
Definition: baseraycastquery.h:37
This class is a runtime container for all NavData that represents the world from the point of view of...
Definition: database.h:64
This class defines a two-dimensional vector whose coordinates are stored using floating-point numbers...
Definition: vec2f.h:24
NavTrianglePtr m_arrivalTrianglePtr
Updated during processing to indicate the NavMesh triangle that corresponds to m_arrivalPos3f.
Definition: baseraycastquery.h:132
Base class for RayCastQuery.
Definition: baseraycastquery.h:47
Definition: gamekitcrowddispersion.h:20
Indicates that a NavMesh triangle could not be found for the starting point.
Definition: baseraycastquery.h:34
Indicates that the query has not yet been initialized.
Definition: iquery.h:346
Indicates that the query has not yet been launched.
Definition: baseraycastquery.h:32
Utilities for dealing with NavData coordinates, which are expressed in a world space based on integer...
Definition: worldintegerpos.h:21
DynamicOutputMode m_dynamicOutputMode
Specifies the type of data stored in m_queryDynamicOutput.
Definition: baseraycastquery.h:139
Vec3f m_collisionPos3f
Updated to indicate the position at which the ray collided with the NavMesh border or NavTag...
Definition: baseraycastquery.h:109
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
Indicates that the query has not yet been launched.
Definition: iquery.h:347
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
Each instance of this class uniquely identifies a singleNavHalfEdge in a NavFloor.
Definition: navhalfedgerawptr.h:34
Indicates that a collision point was found and that a final arrival position was calculated successfu...
Definition: baseraycastquery.h:43
This class defines a three-dimensional vector whose coordinates are stored using floating-point numbe...
Definition: vec3f.h:23
RayCastQueryResult m_result
Updated during processing to indicate the result of the query.
Definition: baseraycastquery.h:137
Indicates that the starting point is very close to a NavMesh border, such that moving back the collis...
Definition: baseraycastquery.h:36