gwnavruntime/queries/utils/basesegmentcastquery.h Source File

basesegmentcastquery.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 
8 #pragma once
9 
15 
16 
17 namespace Kaim
18 {
19 
22 {
25 
32 
36 };
37 
40 {
41 public:
42  static QueryType GetStaticType() { return TypeSegmentCast; }
43  virtual QueryType GetType() const { return TypeSegmentCast; }
44  virtual void BuildQueryBlob(BaseBlobHandler* blobHandler);
45  virtual void InitFromQueryBlob(World* world, void* blob);
46  virtual Ptr<BaseBlobHandler> CreateQueryBlobHandler() { return CreateStaticQueryBlobHandler(); }
47  static Ptr<BaseBlobHandler> CreateStaticQueryBlobHandler();
48 
49 
50  // ---------------------------------- Main API Functions ----------------------------------
51 
52  SegmentCastQueryResult GetResult() const;
53  const Vec3f& GetStartPos() const;
54  const Vec3f& GetCollisionPos() const;
55  const Vec3f& GetArrivalPos() const;
56  const Vec2f& GetNormalizedDir2d() const;
57  const NavTrianglePtr& GetStartTrianglePtr() const;
58  const NavTrianglePtr& GetArrivalTrianglePtr() const;
59  const NavHalfEdgePtr& GetCollisionNavHalfEdgePtr() const;
60  KyFloat32 GetRadius() const;
61  KyFloat32 GetMaxDist() const;
62  KyFloat32 GetSafetyDist() const;
63  DynamicOutputMode GetDynamicOutputMode() const;
64  QueryDynamicOutput* GetQueryDynamicOutput() const;
65 
66  const PositionSpatializationRange& GetPositionSpatializationRange() const;
67 
68  const WorldIntegerPos& GetStartIntegerPos() const;
69  const WorldIntegerPos& GetArrivalIntegerPos() const;
70 
71 protected:
72  BaseSegmentCastQuery();
73  virtual ~BaseSegmentCastQuery(){}
74 
75  void BindToDatabase(Database* database);
76  void Initialize(const Vec3f& startPos, KyFloat32 radius, const Vec2f& normalizedDir2d, KyFloat32 maxDist);
77 
78  void SetStartTrianglePtr(const NavTrianglePtr& startTrianglePtr);
79  void SetPositionSpatializationRange(const PositionSpatializationRange& positionSpatializationRange);
80  void SetSafetyDist(KyFloat32 safetyDist);
81  void SetDynamicOutputMode(DynamicOutputMode savingMode);
82  void SetQueryDynamicOutput(QueryDynamicOutput* queryDynamicOutput);
83 
84  void SetStartIntegerPos(const WorldIntegerPos& startIntegerPos);
85  void SetResult(SegmentCastQueryResult result);
86  SegmentCastQueryResult ConvertTraversalResultToSegmentCastResult(TraversalResult traversalRC);
87 
88 protected:
89  WorldIntegerPos m_startIntegerPos;
90  WorldIntegerPos m_arrivalIntegerPos;
91 
97 
101 
104 
108 
116 
120 
123 
125 
127 
134  Ptr<QueryDynamicOutput> m_queryDynamicOutput;
135 };
136 
137 }
138 
140 
141 
Indicates that insufficient working memory caused the query to stop.
Definition: basesegmentcastquery.h:30
Vec3f m_startPos3f
The starting position of the segment.
Definition: basesegmentcastquery.h:92
Indicates that an error occured during the query computation.
Definition: basesegmentcastquery.h:31
Indicates that the NavTag at the starting point was forbidden.
Definition: basesegmentcastquery.h:27
KyFloat32 m_radius
The half-width of the segment .
Definition: basesegmentcastquery.h:94
Vertical range (above, below) that represents the altitude tolerance for a position to be inside the ...
Definition: positionspatializationrange.h:17
NavTrianglePtr m_startTrianglePtr
The NavMesh triangle that corresponds to m_startPos3f. You can set it as an input or retrieve it as a...
Definition: basesegmentcastquery.h:96
Base class for all the queries that do not need to be time-sliced.
Definition: iquery.h:245
Indicates that the query has not yet been initialized.
Definition: basesegmentcastquery.h:23
Indicates that a final arrival position was calculated successfully.
Definition: basesegmentcastquery.h:34
Indicates that the query has not yet been launched.
Definition: basesegmentcastquery.h:24
This class is a runtime container for Autodesk Navigation WorldElements such as NavData, Bots, BoxObstacles, TagVolumes...
Definition: world.h:52
Vec2f m_normalizedDir2d
A normalized vector that represents the direction in which the segment is cast.
Definition: basesegmentcastquery.h:93
DynamicOutputMode
Enumerates possible ways of storing collected data by a query in a QueryDynamicOutput object...
Definition: querydynamicoutput.h:21
SegmentCastQueryResult
Enumerates the possible results of a SegmentCastQuery.
Definition: basesegmentcastquery.h:21
QueryType
Enumerates all the type of query.
Definition: iquery.h:25
NavTrianglePtr m_arrivalTrianglePtr
Updated during processing to indicate the NavMesh triangle that corresponds to m_arrivalPos3f.
Definition: basesegmentcastquery.h:119
Indicates that moving back the collision point resulted in an arrival position that is outside of the...
Definition: basesegmentcastquery.h:29
2d vector using KyFloat32.
Definition: vec2f.h:18
Indicates that a NavMesh triangle could not be found for the starting point.
Definition: basesegmentcastquery.h:26
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
Vec3f m_collisionPos3f
Updated during processing to indicate the position of the collision point between the segment and the...
Definition: basesegmentcastquery.h:107
Indicates that the segment was able to travel its maximum distance without collision.
Definition: basesegmentcastquery.h:33
KyFloat32 m_safetyDist
When a collision is detected, the collision point is moved back along m_normalizedDir2d by this dista...
Definition: basesegmentcastquery.h:100
SegmentCastQueryResult m_result
Updated during processing to indicate the result of the query.
Definition: basesegmentcastquery.h:124
Indicates that the query has not yet been initialized.
Definition: iquery.h:295
Vec3f m_arrivalPos3f
Updated during processing to indicate the final position of the segment at the end of the cast...
Definition: basesegmentcastquery.h:115
Indicates that the starting point is very close to a NavMesh border. Either the segment does not fit ...
Definition: basesegmentcastquery.h:28
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
Base class for SegmentCastQuery.
Definition: basesegmentcastquery.h:39
virtual QueryType GetType() const
Get query type.
Definition: basesegmentcastquery.h:43
Indicates that the query has not yet been launched.
Definition: iquery.h:296
PositionSpatializationRange m_positionSpatializationRange
The altitude range around the position to use when determining m_startTrianglePtr from the m_startPos...
Definition: basesegmentcastquery.h:103
Ptr< QueryDynamicOutput > m_queryDynamicOutput
A ref-counted Ptr to a QueryDynamicOutput instance, used to store the data encountered during the que...
Definition: basesegmentcastquery.h:134
KyFloat32 m_maxDist
Determines the maximum distance the segment will travel.
Definition: basesegmentcastquery.h:95
weird name kept for backward compatibility
Definition: basesegmentcastquery.h:35
DynamicOutputMode m_dynamicOutputMode
Specifies the type of data stored in m_queryDynamicOutput.
Definition: basesegmentcastquery.h:126
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
NavHalfEdgePtr m_collisionHalfEdgePtr
Updated during processing to indicate the triangle edge that the segment collided with...
Definition: basesegmentcastquery.h:122
float KyFloat32
float
Definition: types.h:32
3d vector using 32bits floating points.
Definition: vec3f.h:16