gwnavruntime/world/pointofinterest.h Source File

pointofinterest.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 
11 
12 namespace Kaim
13 {
14 
17 
18 
21 {
22 public:
23  // ------------------------------ Functions -----------------------------
24 
26 
28  void SetDefaults()
29  {
30  m_startPosition.Set(0.0f, 0.0f, 0.0f);
31  m_world = nullptr;
32  m_databaseBinding = nullptr;
33  m_poiData = nullptr;
35  m_height = 0.0f;
36  }
37 
38 
39  // ---------------------------------- Public Data Members ----------------------------------
40 
43 
47  Ptr<DatabaseBinding> m_databaseBinding;
48 
49  void* m_poiData;
50  Vec3f m_startPosition;
51 
57 
62 };
63 
64 
65 
72 {
73  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_Spatialization)
75 
76 public:
77  static WorldElementType GetStaticType() { return TypePointOfInterest; }
78  virtual WorldElementType GetType() const { return TypePointOfInterest; }
79 
80  virtual const char* GetTypeName() const { return "PointOfInterest"; }
81 
82 
83  // ---------------------------------- Main API Functions ----------------------------------
84 
86  PointOfInterest(const PointOfInterestInitConfig& initConfig);
87 
88  ~PointOfInterest();
89 
90 
95  void Init(const PointOfInterestInitConfig& initConfig);
96 
99  void Clear();
100 
108  void AddToWorld();
109 
116  void RemoveFromWorld();
117 
118 
119  void SetPosition(const Vec3f& position);
120 
121  // ---------------------------------- Getters ----------------------------------
122 
123  const SpatializedPoint& GetSpatializedPoint() const;
124  void* GetPointOfInterestData() const;
125  KyUInt32 GetPointOfInterestType() const;
126 
127 
128 public: // internal
129  virtual void DoSendVisualDebug(VisualDebugServer& server, VisualDebugSendChangeEvent changeEvent); // Inherited from WorldElement
130 
131  // Updates the SpatializedPoint position with the data provided
132  // in the PointOfInterestUpdateConfig.
133  // Computes then the spatialization of the SpatializedPoint.
134  void UpdateSpatialization();
135 
136 private:
137  Vec3f m_position;
138  Ptr<SpatializedPoint> m_spatializedPoint;
139  void* m_poiData;
140  KyUInt32 m_poiType;
141 };
142 
143 
144 KY_INLINE PointOfInterest::PointOfInterest() : m_poiData(nullptr) , m_poiType(PointOfInterestType_Undefined) {}
145 KY_INLINE PointOfInterest::PointOfInterest(const PointOfInterestInitConfig& initConfig)
146  : m_poiData(nullptr) , m_poiType(PointOfInterestType_Undefined)
147 {
148  Init(initConfig);
149 }
150 
151 KY_INLINE PointOfInterest::~PointOfInterest() { Clear(); }
152 
153 KY_INLINE void PointOfInterest::SetPosition(const Vec3f& position) { m_position = position; }
154 
155 KY_INLINE const SpatializedPoint& PointOfInterest::GetSpatializedPoint() const { return *m_spatializedPoint; }
156 KY_INLINE void* PointOfInterest::GetPointOfInterestData() const { return m_poiData; }
157 KY_INLINE KyUInt32 PointOfInterest::GetPointOfInterestType() const { return m_poiType; }
158 
159 KY_INLINE void PointOfInterest::UpdateSpatialization() { m_spatializedPoint->UpdateSpatialization(m_position); ForceSendAllVisualDebug(); }
160 
161 } // namespace Kaim
162 
void ForceSendAllVisualDebug()
Call this when something impacts all your visual debug data.
Definition: worldelement.h:123
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
Ptr< DatabaseBinding > m_databaseBinding
Defines the Databases in which the CylinderObstacle will be spatialized.
Definition: pointofinterest.h:47
void Set(KyFloat32 _x, KyFloat32 _y, KyFloat32 _z)
Sets {_x, _y, _z}.
Definition: vec3f.h:29
void SetDefaults()
Sets all members to their default value.
Definition: pointofinterest.h:28
KyFloat32 m_height
PointOfInterest might have an height.
Definition: pointofinterest.h:56
static const KyUInt32 PointOfInterestType_FirstClient
The first customizable PointOfInterest type value.
Definition: pointofinterest.h:16
void Clear()
Prepares this instance to destruction and / or reuse: sets all members to their default values and cl...
Definition: pointofinterest.cpp:36
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:196
This class is a runtime container for Autodesk Navigation WorldElements such as NavData, Bots, BoxObstacles, TagVolumes...
Definition: world.h:52
World * m_world
Mandatory: you must provide a World when calling CylinderObstacle::Init.
Definition: pointofinterest.h:42
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
Class used to provide PointOfInterest initialization parameters.
Definition: pointofinterest.h:20
WorldElementType
Enumerates the WorldElement types.
Definition: worldelementtype.h:13
Base internal class used to represent elements that can be added to a World, such as instances of Dat...
Definition: worldelement.h:41
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
static const KyUInt32 PointOfInterestType_Undefined
The default value of PointOfInterest type.
Definition: pointofinterest.h:15
void RemoveFromWorld()
Removes the PointOfInterest from the World.
Definition: pointofinterest.cpp:61
void AddToWorld()
Adds the PointOfInterest to the World.
Definition: pointofinterest.cpp:48
PointOfInterest is a tagged position spatialized into the NavMesh.
Definition: pointofinterest.h:71
void Init(const PointOfInterestInitConfig &initConfig)
Sets m_world and allocates memory depending on m_databaseBinding.
Definition: pointofinterest.cpp:17
SpatializedPoint is used to the NavTriangle of "object": Bot, CylinderObstacle, BoxObstacle and Point...
Definition: spatializedpoint.h:146
KyUInt32 m_poiType
Defines the type of the PointOfInterest.
Definition: pointofinterest.h:61
float KyFloat32
float
Definition: types.h:32
3d vector using 32bits floating points.
Definition: vec3f.h:16