gwnavruntime/world/pointofinterest.h Source File

pointofinterest.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: LAPA - secondary contact: JUBA
9 #ifndef Navigation_PointOfInterest_H
10 #define Navigation_PointOfInterest_H
11 
12 
15 
16 
17 namespace Kaim
18 {
19 
22 
23 
26 {
27 public:
28  // ---------------------------------- Public Member Functions ----------------------------------
29 
31 
33  void SetDefaults()
34  {
35  m_startPosition.Set(0.0f, 0.0f, 0.0f);
36  m_world = KY_NULL;
38  m_poiData = KY_NULL;
40  m_height = 0.0f;
41  }
42 
43 
44  // ---------------------------------- Public Data Members ----------------------------------
45 
47  World* m_world;
48 
52  Ptr<DatabaseBinding> m_databaseBinding;
53 
54  void* m_poiData;
55  Vec3f m_startPosition;
56 
62 
67 };
68 
69 
70 
76 class PointOfInterest: public WorldElement
77 {
78  KY_DEFINE_NEW_DELETE_OPERATORS(MemStat_Spatialization)
80 
81 public:
82  static WorldElementType GetStaticType() { return TypePointOfInterest; }
83  virtual WorldElementType GetType() const { return TypePointOfInterest; }
84 
85  virtual const char* GetTypeName() const { return "PointOfInterest"; }
86 
87 
88  // ---------------------------------- Main API Functions ----------------------------------
89 
91  PointOfInterest(const PointOfInterestInitConfig& initConfig);
92 
93  ~PointOfInterest();
94 
95 
100  void Init(const PointOfInterestInitConfig& initConfig);
101 
104  void Clear();
105 
113  void AddToWorld();
114 
121  void RemoveFromWorld();
122 
123 
124  void SetPosition(const Vec3f& position);
125 
126  // ---------------------------------- Getters ----------------------------------
127 
128  const SpatializedPoint& GetSpatializedPoint() const;
129  void* GetPointOfInterestData() const;
130  KyUInt32 GetPointOfInterestType() const;
131 
132 
133 public: // internal
134  virtual void DoSendVisualDebug(VisualDebugServer& server, VisualDebugSendChangeEvent changeEvent); // Inherited from WorldElement
135 
136  // Updates the SpatializedPoint position with the data provided
137  // in the PointOfInterestUpdateConfig.
138  // Computes then the spatialization of the SpatializedPoint.
139  void UpdateSpatialization();
140 
141 private:
142  Vec3f m_position;
143  Ptr<SpatializedPoint> m_spatializedPoint;
144  void* m_poiData;
145  KyUInt32 m_poiType;
146 };
147 
148 
149 KY_INLINE PointOfInterest::PointOfInterest() : m_poiData(KY_NULL) , m_poiType(PointOfInterestType_Undefined) {}
150 KY_INLINE PointOfInterest::PointOfInterest(const PointOfInterestInitConfig& initConfig)
151  : m_poiData(KY_NULL) , m_poiType(PointOfInterestType_Undefined)
152 {
153  Init(initConfig);
154 }
155 
156 KY_INLINE PointOfInterest::~PointOfInterest() { Clear(); }
157 
158 KY_INLINE void PointOfInterest::SetPosition(const Vec3f& position) { m_position = position; }
159 
160 KY_INLINE const SpatializedPoint& PointOfInterest::GetSpatializedPoint() const { return *m_spatializedPoint; }
161 KY_INLINE void* PointOfInterest::GetPointOfInterestData() const { return m_poiData; }
162 KY_INLINE KyUInt32 PointOfInterest::GetPointOfInterestType() const { return m_poiType; }
163 
164 KY_INLINE void PointOfInterest::UpdateSpatialization() { m_spatializedPoint->UpdateSpatialization(m_position); ForceSendAllVisualDebug(); }
165 
166 } // namespace Kaim
167 
168 #endif // Navigation_PointOfInterest_H
void ForceSendAllVisualDebug()
Call this when something impacts all your visual debug data.
Ptr< DatabaseBinding > m_databaseBinding
Defines the Databases in which the CylinderObstacle will be spatialized.
Definition: pointofinterest.h:61
void Set(KyFloat32 _x, KyFloat32 _y, KyFloat32 _z)
Sets the coordinates.
Definition: vec3f.h:52
void SetDefaults()
Sets all members to their default value.
Definition: pointofinterest.h:38
#define KY_NULL
Null value.
Definition: types.h:247
KyFloat32 m_height
PointOfInterest might have an height.
Definition: pointofinterest.h:70
static const KyUInt32 PointOfInterestType_FirstClient
The first customizable PointOfInterest type value.
Definition: pointofinterest.h:21
void Clear()
Prepares this instance to destruction and / or reuse: sets all members to their default values and cl...
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
This class is a runtime container for Gameware Navigation WorldElements such as NavData, Bots, BoxObstacles, TagVolumes...
Definition: world.h:54
World * m_world
Mandatory: you must provide a World when calling CylinderObstacle::Init.
Definition: pointofinterest.h:56
Class used to provide PointOfInterest initialization parameters.
Definition: pointofinterest.h:25
WorldElementType
Enumerates the WorldElement types.
Definition: worldelementtype.h:15
Base internal class used to represent elements that can be added to a World, such as instances of Dat...
Definition: worldelement.h:45
Definition: gamekitcrowddispersion.h:20
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
The VisualDebugServer manages the sending of data to clients.
Definition: visualdebugserver.h:254
static const KyUInt32 PointOfInterestType_Undefined
The default value of PointOfInterest type.
Definition: pointofinterest.h:20
void RemoveFromWorld()
Removes the PointOfInterest from the World.
void AddToWorld()
Adds the PointOfInterest to the World.
PointOfInterest is a tagged position spatialized into the NavMesh.
Definition: pointofinterest.h:86
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
void Init(const PointOfInterestInitConfig &initConfig)
Sets m_world and allocates memory depending on m_databaseBinding.
Internal class used for point spatialization in NavData.
Definition: spatializedpoint.h:171
KyUInt32 m_poiType
Defines the type of the PointOfInterest.
Definition: pointofinterest.h:75
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