gwnavruntime/queries/diskcangoquery.h Source File

diskcangoquery.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 // Primary contact: JUBA - secondary contact: NOBODY
8 #ifndef Navigation_DiskCanGoQuery_H
9 #define Navigation_DiskCanGoQuery_H
10 
12 
20 
21 namespace Kaim
22 {
23 
24 class NavTriangleRawPtr;
25 
29 template<class TraverseLogic>
31 {
32 public:
33  // ---------------------------------- Public Member Functions ----------------------------------
34 
36  virtual ~DiskCanGoQuery() {}
37 
38  // ---------------------------------- Functions to set up the query ----------------------------------
39 
43  void BindToDatabase(Database* database);
44 
51  void Initialize(const Vec3f& startPos, const Vec3f& destPos, KyFloat32 radius);
52 
53  // ---------------------------------- write accessors for query inputs ----------------------------------
54 
58  void SetStartTrianglePtr(const NavTrianglePtr& startTrianglePtr);
59 
62  void SetQueryDynamicOutput(QueryDynamicOutput* queryDynamicOutput);
63 
64  // ---------------------------------- write accessors for query parameters ----------------------------------
65 
68  void SetPositionSpatializationRange(const PositionSpatializationRange& positionSpatializationRange);
69 
72  void SetQueryType(DiskCanGoQueryType queryType);
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 
88  // ---------------------------------- Accessors ----------------------------------
89 
90  DiskCanGoQueryResult GetResult() const;
91  const Vec3f& GetStartPos() const;
92  const Vec3f& GetDestPos() const;
93  const NavTrianglePtr& GetStartTrianglePtr() const;
94  const NavTrianglePtr& GetDestTrianglePtr() const;
95  KyFloat32 GetRadius() const;
96  DiskCanGoQueryType GetQueryType() 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  void SetDestIntegerPos(const WorldIntegerPos& destIntegerPos);
106  const WorldIntegerPos& GetStartIntegerPos() const;
107  const WorldIntegerPos& GetDestIntegerPos() const;
108 
109 private:
110  void ForceDiskCanGo(WorkingMemory* workingMemory, const CellBox& cellBox, const NavTriangleRawPtr& startTriangleRawPtr);
111  KyResult RayCastQueryFromStartOnTheRigth(WorkingMemory* workingMemory, const Vec2f& normalizedDir2d, RayCastQuery<TraverseLogic>& rayCastQuery,
112  RayCastQueryResult& queryOnRightResult, KyFloat32& borderDistOnRight);
113  KyResult RayCastQueryFromStartOnTheLeft(WorkingMemory* workingMemory, const Vec2f& normalizedDir2d, RayCastQuery<TraverseLogic>& rayCastQuery,
114  RayCastQueryResult& queryOnLeftResult, KyFloat32& borderDistOnLeft);
115 
116 
117 public:
118  // ---------------------------------- Public Data Members ----------------------------------
119 };
120 
121 }
122 
124 
125 
126 #endif //Navigation_DiskCanGoQuery_H
127 
128 
This class gather the data encountered along some query process.
Definition: querydynamicoutput.h:61
This class represents a two-dimensional axis-aligned bounding box whose dimensions are stored using 3...
Definition: box2i.h:119
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
Base class for DiskCanGoQuery.
Definition: basediskcangoquery.h:64
virtual void Advance(WorkingMemory *workingMemory)
This function is called by the QueryQueue to process one step on the query.
Definition: diskcangoquery.inl:71
DiskCanGoQueryType
Enumerates the possible behaviors of a BaseDiskCanGoQuery when the the starting point lies inside the...
Definition: basediskcangoquery.h:41
void SetPositionSpatializationRange(const PositionSpatializationRange &positionSpatializationRange)
Write accessor for m_positionSpatializationRange.
Definition: diskcangoquery.inl:40
#define KY_NULL
Null value.
Definition: types.h:247
void PerformQuery(WorkingMemory *workingMemory=0)
Performs the query.
Definition: diskcangoquery.inl:78
DynamicOutputMode
Enumerates possible ways of storing crossed data from a query in a QueryDynamicOutput object...
Definition: querydynamicoutput.h:26
RayCastQueryResult
Enumerates the possible results of a RayCastQuery.
Definition: baseraycastquery.h:29
DiskCanGoQueryResult
Enumerates the possible results of a DiskCanGoQuery.
Definition: basediskcangoquery.h:24
void SetStartTrianglePtr(const NavTrianglePtr &startTrianglePtr)
The NavMesh triangle that corresponds to m_startPos3f.
Definition: diskcangoquery.inl:28
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 SetQueryType(DiskCanGoQueryType queryType)
Write accessor for m_queryType.
Definition: diskcangoquery.inl:34
Definition: gamekitcrowddispersion.h:20
void BindToDatabase(Database *database)
Binds the query with the specified Database, clears all the inputs and outputs and sets all other par...
Definition: diskcangoquery.inl:16
Each instance of this class uniquely identifies a single NavTriangle in a NavFloor.
Definition: navtrianglerawptr.h:30
Utilities for dealing with NavData coordinates, which are expressed in a world space based on integer...
Definition: worldintegerpos.h:21
void SetDynamicOutputMode(DynamicOutputMode savingMode)
Write accessor for m_dynamicOutputMode.
Definition: diskcangoquery.inl:36
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 NavTriangle in a NavFloor.
Definition: navtriangleptr.h:22
void SetQueryDynamicOutput(QueryDynamicOutput *queryDynamicOutput)
Write accessor for m_queryDynamicOutput.
Definition: diskcangoquery.inl:38
The DiskCanGoQuery tests whether a disk with a specified radius can pass from a starting point to an ...
Definition: diskcangoquery.h:30
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
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43
This class defines a three-dimensional vector whose coordinates are stored using floating-point numbe...
Definition: vec3f.h:23