gwnavruntime/queries/raycastfull3dquery.h Source File

raycastfull3dquery.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 #pragma once
8 
13 
14 namespace Kaim
15 {
16 
17 class NavFloor;
18 class Box3f;
19 
22 {
25 
28 };
29 
33 {
34 public:
35  static QueryType GetStaticType() { return TypeRayCastFull3D; }
36  virtual QueryType GetType() const { return TypeRayCastFull3D; }
37 
38  // ------------------------------ Functions -----------------------------
39 
41  virtual ~RayCastFull3dQuery() {}
42 
43  // ---------------------------------- Functions to set up the query ----------------------------------
44 
48  void BindToDatabase(Database* database);
49 
53  void Initialize(const Vec3f& startPos, const Vec3f& destPos);
54 
55  // ---------------------------------- Query framework functions ----------------------------------
56 
57  virtual void Advance(WorkingMemory* workingMemory)
58  {
59  PerformQuery(workingMemory);
60  m_processStatus = QueryDone;
61  }
62 
64  void PerformQuery(WorkingMemory* workingMemory = nullptr);
65 
66  // ---------------------------------- Accessors ----------------------------------
67 
68  RayCast3dQueryResult GetResult() const { return m_result; }
69 
70 public: // internal
71  void SetResult(RayCast3dQueryResult result) { m_result = result; }
72  class RayCastData
73  {
74  public:
75  RayCastData(const Vec3f& startPos, const Vec3f& destPos) : m_dir(destPos-startPos), m_dirInv(1.f, 1.f, 1.f)
76  {
77  m_dirIsNullOnAxis[0] = false;
78  m_dirIsNullOnAxis[1] = false;
79  m_dirIsNullOnAxis[2] = false;
80  }
81  public:
82  Vec3f m_dir;
83  Vec3f m_dirInv;
84  CoordBox64 m_coordBoxOfTest;
85  bool m_dirIsNullOnAxis[3];
86  };
87 
88  void CollideAgainsttriangle(const Vec3f& a, const Vec3f& b, const Vec3f& c, KyFloat32& currentCollisionDistance);
89  void RayCast3DAgainstNavFloor(NavFloor* navFloor, const RayCastData& rayCastData, const CoordPos64& cellOrigin, KyFloat32& currentCollisionDistance);
90  bool RayVersusBox3f(const RayCastData& rayCastData, const Box3f& box);
91 
92 public:
96 
100 
102 };
103 
104 }
105 
106 
107 
108 
Vec3f m_startPos3f
start position
Definition: raycastfull3dquery.h:93
virtual QueryType GetType() const
Get query type.
Definition: raycastfull3dquery.h:36
QueryProcessStatus m_processStatus
Modified by the query within Advance(). Do not modify.
Definition: iquery.h:231
Box2LL CoordBox64
A type that represents a bounding box in the integer 2D grid.
Definition: navmeshtypes.h:17
Base class for all the queries that do not need to be time-sliced.
Definition: iquery.h:245
RayCast in full 3d useful for implementing picking on NavMesh.
Definition: raycastfull3dquery.h:32
void BindToDatabase(Database *database)
Binds the query with the specified Database, clears all the inputs and outputs and sets all other par...
Definition: raycastfull3dquery.cpp:24
Indicates that the point provided is outside the navigable boundaries of the NavMesh.
Definition: raycastfull3dquery.h:26
RayCast3dQueryResult
Enumerates the possible results of a RayCast3dQuery.
Definition: raycastfull3dquery.h:21
QueryType
Enumerates all the type of query.
Definition: iquery.h:25
Indicates that the query was completed successfully; a triangle was found.
Definition: raycastfull3dquery.h:27
virtual void Advance(WorkingMemory *workingMemory)
This function is called by the QueryQueue to process one step on the query.
Definition: raycastfull3dquery.h:57
void PerformQuery(WorkingMemory *workingMemory=nullptr)
If workingMemory param is nullptr, m_database.GetWorkingMemory() will be used.
Definition: raycastfull3dquery.cpp:50
Vec2LL CoordPos64
A type that represents the position of a point within the 2D integer grid.
Definition: navmeshtypes.h:16
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
Indicates that the query has not yet been initialized.
Definition: iquery.h:295
NavTrianglePtr m_resultTrianglePtr
Updated during processing to store the nearest triangle found to m_startPos3f.
Definition: raycastfull3dquery.h:99
Vec3f m_destPos3f
destination position
Definition: raycastfull3dquery.h:94
Indicates the query has not yet been initialized.
Definition: raycastfull3dquery.h:23
Each instance of this class uniquely identifies a single NavTriangle in a NavFloor.
Definition: navtriangleptr.h:17
Indicates that the query has not yet been launched.
Definition: iquery.h:296
Vec3f m_collisionPoint3f
collision position
Definition: raycastfull3dquery.h:95
RayCast3dQueryResult m_result
Updated during processing to indicate the result of the query.
Definition: raycastfull3dquery.h:101
Indicates the query has not yet been launched.
Definition: raycastfull3dquery.h:24
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
float KyFloat32
float
Definition: types.h:32
3d vector using 32bits floating points.
Definition: vec3f.h:16