gwnavruntime/queries/spatializedpointcollectorinaabbquery.h Source File

spatializedpointcollectorinaabbquery.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: LAPA - secondary contact: NOBODY
8 #ifndef Navigation_SpatializedPointCollectorInAABBQuery_H
9 #define Navigation_SpatializedPointCollectorInAABBQuery_H
10 
11 
18 
19 
20 namespace Kaim
21 {
22 
23 class SpatializedPointCollectorFilter_CollectAll
24 {
25 public:
26  bool ShouldCollectSpatializedPoint(SpatializedPoint* /*spatializedPoint*/) { return true; }
27 };
28 
29 class SpatializedPointCollectorFilter_SelectiveCollect
30 {
31 public:
32  SpatializedPointCollectorFilter_SelectiveCollect()
33  {
34  for (KyUInt32 i = 0; i < SpatializedPointObjectType_Count; ++i)
35  m_selection[i] = false;
36  }
37 
38  void Select(SpatializedPointObjectType type) { m_selection[type] = true; }
39 
40  bool ShouldCollectSpatializedPoint(SpatializedPoint* spatializedPoint)
41  {
42  return m_selection[spatializedPoint->GetObjectType()];
43  }
44 
45 public:
46  bool m_selection[SpatializedPointObjectType_Count];
47 };
48 
52 template <class SpatializedPointCollectorFilter = SpatializedPointCollectorFilter_CollectAll>
53 class SpatializedPointCollectorInAABBQuery : public BaseSpatializedPointCollectorInAABBQuery
54 {
55 public:
56  // ---------------------------------- Public Member Functions ----------------------------------
57 
59  SpatializedPointCollectorInAABBQuery(const SpatializedPointCollectorFilter& collectorFilter);
61 
62  // ---------------------------------- Functions to set up the query ----------------------------------
63 
67  void BindToDatabase(Database* database);
68 
74  void Initialize(const Vec3f& startPos, const Box3f& extentBox);
75 
76  // ---------------------------------- write accessors for query inputs ----------------------------------
77 
81  void SetStartTrianglePtr(const NavTrianglePtr& startTrianglePtr);
82 
85  void SetQueryDynamicOutput(QueryDynamicOutput* queryDynamicOutput);
86 
87  // ---------------------------------- write accessors for query parameters ----------------------------------
88 
92  void SetPositionSpatializationRange(const PositionSpatializationRange& positionSpatializationRange);
93 
94  // ---------------------------------- Query framework functions ----------------------------------
95 
96  virtual void Advance(WorkingMemory* workingMemory);
97 
101  void PerformQuery(WorkingMemory* workingMemory = KY_NULL);
102 
103  // ------------------------------- Accessors ----------------------------------
104 
106  const Vec3f& GetStartPos() const;
107  const Box3f& GetExtentBox() const;
108  const NavTrianglePtr& GetStartTrianglePtr() const;
109  QueryDynamicOutput* GetQueryDynamicOutput() const;
110 
111  const PositionSpatializationRange& GetPositionSpatializationRange() const;
112 
113 public:
114  void PerformQueryWithInputCoordPos(WorkingMemory* workingMemory);
115  void SetStartIntegerPos(const WorldIntegerPos& startIntegerPos);
116  const WorldIntegerPos& GetStartIntegerPos() const;
117 
118 private:
119  void SetResult(SpatializedPointCollectorInAABBQueryResult result);
120 
121  void RunCollectorTraversal(SpatializedPointCollectorContext* traversalContext, ScopedDynamicOutput& scopedDynamicOutput);
122  KyResult CollectInNavFloor(ScopedDynamicOutput& scopedDynamicOutput, const NavFloorRawPtr& navFloorRawPtr);
123  KyResult CollectInNavGraphEdge(ScopedDynamicOutput& scopedDynamicOutput, const NavGraphEdgeRawPtr& navGraphEdgeRawPtr);
124  KyResult ProcessNavFloorNode(SpatializedPointCollectorContext* traversalContext, ScopedDynamicOutput& scopedDynamicOutput, const NavFloorRawPtr& navFloorRawPtr);
125  KyResult ProcessNavGraphEdgeNode(SpatializedPointCollectorContext* traversalContext, ScopedDynamicOutput& scopedDynamicOutput, const NavGraphEdgeRawPtr& navGraphEdgeRawPtr);
126 public:
127  SpatializedPointCollectorFilter m_spatializedPointCollectorFilter;
128 };
129 
130 }
131 
133 
134 
135 #endif //Navigation_SpatializedPointCollectorInAABBQuery_H
136 
This class gather the data encountered along some query process.
Definition: querydynamicoutput.h:61
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
SpatializedPointCollectorInAABBQueryResult
Enumerates the possible results of a SpatializedPointCollectorInAABBQuery.
Definition: basespatializedpointcollectorinaabbquery.h:26
void SetQueryDynamicOutput(QueryDynamicOutput *queryDynamicOutput)
Write accessor for m_queryDynamicOutput.
Definition: spatializedpointcollectorinaabbquery.inl:56
#define KY_NULL
Null value.
Definition: types.h:247
Each instance of this class uniquely identifies a single NavGraphEdge in a NavGraph.
Definition: navgraphedgerawptr.h:33
The SpatializedPointCollectorInAABBQuery class retrieves all SpatializedPoints within an Axis-Aligned...
Definition: spatializedpointcollectorinaabbquery.h:57
This class represents a three-dimensional axis-aligned bounding box whose dimensions are stored using...
Definition: box3f.h:25
This class is a runtime container for all NavData that represents the world from the point of view of...
Definition: database.h:64
virtual void Advance(WorkingMemory *workingMemory)
This function is called by the QueryQueue to process one step on the query.
Definition: spatializedpointcollectorinaabbquery.inl:34
SpatializedPointObjectType
Enumerates the possible object types the SpatializedPoint refers to.
Definition: spatializedpoint.h:35
Definition: gamekitcrowddispersion.h:20
void SetPositionSpatializationRange(const PositionSpatializationRange &positionSpatializationRange)
Defines a range of altitudes around the starting position that will be used to retrieve a NavMesh tri...
Definition: spatializedpointcollectorinaabbquery.inl:46
Utilities for dealing with NavData coordinates, which are expressed in a world space based on integer...
Definition: worldintegerpos.h:21
Each instance of this class uniquely identifies a single NavTriangle in a NavFloor.
Definition: navtriangleptr.h:22
void SetStartTrianglePtr(const NavTrianglePtr &startTrianglePtr)
The NavMesh triangle that corresponds to the starting position.
Definition: spatializedpointcollectorinaabbquery.inl:41
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
void PerformQuery(WorkingMemory *workingMemory=0)
Performs the query.
Definition: spatializedpointcollectorinaabbquery.inl:106
void BindToDatabase(Database *database)
Binds the query with the specified Database, clears all the inputs and outputs and sets all other par...
Definition: spatializedpointcollectorinaabbquery.inl:22
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
This class defines a three-dimensional vector whose coordinates are stored using floating-point numbe...
Definition: vec3f.h:23
Each instance of this class uniquely identifies a single NavFloor.
Definition: navfloorrawptr.h:30