gwnavruntime/queries/raycastquery.h Source File

raycastquery.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_RayCastQuery_H
10 #define Navigation_RayCastQuery_H
11 
12 
17 
18 namespace Kaim
19 {
20 
21 class QueryUtils;
22 class NavHalfEdgeRawPtr;
23 class RawNavTagSubSegment;
24 template <class T> class WorkingMemArray;
25 
26 
34 template<class TraverseLogic>
35 class RayCastQuery : public BaseRayCastQuery
36 {
37 public:
38  // ---------------------------------- Public Member Functions ----------------------------------
39 
40  RayCastQuery();
41  virtual ~RayCastQuery() {}
42 
43  // ---------------------------------- Functions to set up the query ----------------------------------
44 
48  void BindToDatabase(Database* database);
49 
55  void Initialize(const Vec3f& startPos, const Vec2f& maxMove2D);
56 
57  // ---------------------------------- write accessors for query inputs ----------------------------------
58 
62  void SetStartTrianglePtr(const NavTrianglePtr& startTrianglePtr);
63 
66  void SetQueryDynamicOutput(QueryDynamicOutput* queryDynamicOutput);
67 
68  // ---------------------------------- write accessors for query parameters ----------------------------------
69 
72  void SetPositionSpatializationRange(const PositionSpatializationRange& positionSpatializationRange);
73 
76  void SetDynamicOutputMode(DynamicOutputMode savingMode);
77 
78  // ---------------------------------- Query framework functions ----------------------------------
79 
80  virtual void Advance(WorkingMemory* workingMemory);
81 
85  void PerformQuery(WorkingMemory* workingMemory = KY_NULL);
86 
87  // ---------------------------------- Accessors ----------------------------------
88 
89  RayCastQueryResult GetResult() const;
90  const Vec3f& GetStartPos() const;
91  const Vec3f& GetCollisionPos() const;
92  const Vec3f& GetArrivalPos() const;
93  const Vec2f& GetMaxMove2D() const;
94  const NavTrianglePtr& GetStartTrianglePtr() const;
95  const NavTrianglePtr& GetArrivalTrianglePtr() const;
96  const NavHalfEdgePtr& GetCollisionNavHalfEdgePtr() const;
97  DynamicOutputMode GetDynamicOutputMode() const;
98  QueryDynamicOutput* GetQueryDynamicOutput() const;
99 
100  const PositionSpatializationRange& GetPositionSpatializationRange() const;
101 
102 public : // internal
103  void PerformQueryWithInputCoordPos(WorkingMemory* workingMemory);
104  void SetStartIntegerPos(const WorldIntegerPos& startIntegerPos);
105  const WorldIntegerPos& GetStartIntegerPos() const;
106  const WorldIntegerPos& GetArrivalIntegerPos() const;
107 
108 private:
109  void RayCast_BorderHit(QueryUtils& queryUtils, const NavHalfEdgeRawPtr& halfEdgeRawPtrHit, const CoordPos64& destCoordPos,
110  CompositeSubSegment& subSegment, ScopedDynamicOutput& scopedDynamicOutput);
111 };
112 
113 }
114 
116 
117 #endif //Navigation_RayCastQuery_H
118 
virtual void Advance(WorkingMemory *workingMemory)
This function is called by the QueryQueue to process one step on the query.
Definition: raycastquery.inl:76
This class gather the data encountered along some query process.
Definition: querydynamicoutput.h:61
#define KY_NULL
Null value.
Definition: types.h:247
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
void SetStartTrianglePtr(const NavTrianglePtr &startTrianglePtr)
The NavMesh triangle that corresponds to m_startPos3f.
Definition: raycastquery.inl:28
void PerformQuery(WorkingMemory *workingMemory=0)
Performs the query.
Definition: raycastquery.inl:83
RayCastQueryResult
Enumerates the possible results of a RayCastQuery.
Definition: baseraycastquery.h:29
void SetQueryDynamicOutput(QueryDynamicOutput *queryDynamicOutput)
Write accessor for m_queryDynamicOutput.
Definition: raycastquery.inl:34
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
void SetDynamicOutputMode(DynamicOutputMode savingMode)
Write accessor for m_dynamicOutputMode.
Definition: raycastquery.inl:32
Definition: gamekitcrowddispersion.h:20
Utilities for dealing with NavData coordinates, which are expressed in a world space based on integer...
Definition: worldintegerpos.h:21
This class is an helper used internally by the Queries to factorize Code that is used in many Queries...
Definition: queryutils.h:30
The RayCastQuery class tests whether a ray (with a width of 0) can be cast from a starting point (m_s...
Definition: raycastquery.h:37
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
void BindToDatabase(Database *database)
Binds the query with the specified Database, clears all the inputs and outputs and sets all other par...
Definition: raycastquery.inl:17
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
This class defines a three-dimensional vector whose coordinates are stored using floating-point numbe...
Definition: vec3f.h:23
void SetPositionSpatializationRange(const PositionSpatializationRange &positionSpatializationRange)
Write accessor for m_positionSpatializationRange.
Definition: raycastquery.inl:40