9 #ifndef Navigation_SpatializedPoint_H
10 #define Navigation_SpatializedPoint_H
22 class DatabaseBinding;
24 class PositionSpatializationRange;
25 class WorldIntegerPos;
29 class CylinderObstacle;
31 class PointOfInterest;
37 SpatializedPointObjectType_Undefined = 0,
38 SpatializedPointObjectType_Bot,
39 SpatializedPointObjectType_CylinderObstacle,
40 SpatializedPointObjectType_BoxObstacle,
41 SpatializedPointObjectType_PointOfInterest,
43 SpatializedPointObjectType_Count
46 enum SpatializationUpdateCoherency
48 SpatializationUpdateCoherency_Maximum,
49 SpatializationUpdateCoherency_Minimum,
55 class PointDbSpatialization
59 PointDbSpatialization();
63 KyResult UpdateFromPrevious(Database* database, const PositionSpatializationRange& spatializationRange, const Vec3f& oldPosition, const PointDbSpatialization& oldDbSpatialization,
64 const Vec3f& newPosition, WorldIntegerPos& newPositionInteger);
66 void UpdateFromScratch(Database* database, const PositionSpatializationRange& spatializationRange, const Vec3f& newPosition, const WorldIntegerPos* newPositionInteger =
KY_NULL);
69 static PositionSpatializationRange GetPositionSpatializationRange(const Database* database, SpatializationUpdateCoherency updateMode,
KyFloat32 height = 0.f);
73 NavTriangleRawPtr m_navTriangle;
79 class PointSpatialization
85 PointSpatialization() : m_pointDbSpatialization(KY_NULL) {}
87 void Init(DatabaseBinding* databaseBinding);
91 void InvalidateAllDbSpatializations();
93 NavTrianglePtr GetNavTrianglePtr(Database* database)
const;
97 bool UpdateSpatialization(
const Vec3f& currentPosition,
const PointSpatialization* updatedCurrentSpatialization,
const Vec3f& newPosition, SpatializationUpdateCoherency updateMode,
KyFloat32 height);
100 void CreateDbSpatializationPoints();
101 void DestroyDbSpatializationPoints();
104 Ptr<DatabaseBinding> m_databaseBinding;
105 PointDbSpatialization* m_pointDbSpatialization;
109 class SpatializedPointInitConfig
114 SpatializedPointInitConfig() { SetDefaults(); }
122 void InitFromBot(Ptr<DatabaseBinding> databaseBinding,
Bot* bot,
KyFloat32 height);
123 void InitFromCylinderObstacle(Ptr<DatabaseBinding> databaseBinding,
CylinderObstacle* cylinderObstacle,
KyFloat32 height);
125 void InitFromPointOfInterest(Ptr<DatabaseBinding> databaseBinding,
PointOfInterest* pointOfInterest,
KyFloat32 height);
133 Ptr<DatabaseBinding> m_databaseBinding;
146 class SpatializedPoint:
public RefCountBase<SpatializedPoint, MemStat_Spatialization>
159 void Invalidate(
KyUInt32 boundDatabaseIdx);
160 void InvalidateAllDbSpatializations();
166 KyUInt32 GetDbSpatializationCount() const;
167 PointDbSpatialization& GetDbSpatialization(
KyUInt32 boundDatabaseIdx) ;
168 const PointDbSpatialization& GetDbSpatialization(
KyUInt32 boundDatabaseIdx) const;
169 const
Vec3f& GetPosition() const;
171 void* GetObject() const;
180 void SetPosition(const
Vec3f& position);
189 bool UpdateSpatialization(const
Vec3f& newPosition, SpatializationUpdateCoherency updateMode = SpatializationUpdateCoherency_Maximum, PointSpatialization* inputOutputUpdatedSpatialization =
KY_NULL);
193 void OnNavFloorDeActivation(
NavFloor* navFloor);
197 const PointSpatialization& GetPointSpatialization() const;
201 PointSpatialization m_pointSpatialization;
206 bool m_wasSpatializationInvalidatedOutOfUpdate;
214 m_objectType = SpatializedPointObjectType_Undefined;
218 KY_INLINE PointDbSpatialization::PointDbSpatialization() : m_navDataChangeIdx(
KyUInt32MAXVAL) {}
220 KY_INLINE
void PointDbSpatialization::Invalidate()
222 m_navTriangle.Invalidate();
225 KY_INLINE
void SpatializedPointInitConfig::InitFromBot(Ptr<DatabaseBinding> databaseBinding, Bot* bot,
KyFloat32 height)
229 m_objectType = SpatializedPointObjectType_Bot;
234 KY_INLINE
void SpatializedPointInitConfig::InitFromCylinderObstacle(Ptr<DatabaseBinding> databaseBinding, CylinderObstacle* cylinderObstacle,
KyFloat32 height)
237 m_object = cylinderObstacle;
238 m_objectType = SpatializedPointObjectType_CylinderObstacle;
243 KY_INLINE
void SpatializedPointInitConfig::InitFromBoxObstacle(Ptr<DatabaseBinding> databaseBinding, BoxObstacle* boxObstacle,
KyUInt32 indexInObject,
KyFloat32 height)
246 m_object = boxObstacle;
247 m_objectType = SpatializedPointObjectType_BoxObstacle;
248 m_indexInObject = indexInObject;
252 KY_INLINE
void SpatializedPointInitConfig::InitFromPointOfInterest(Ptr<DatabaseBinding> databaseBinding,
PointOfInterest* pointOfInterest,
KyFloat32 height)
255 m_object = pointOfInterest;
256 m_objectType = SpatializedPointObjectType_PointOfInterest;
261 KY_INLINE SpatializedPoint::SpatializedPoint()
263 , m_objectType(SpatializedPointObjectType_Undefined)
265 , m_wasSpatializationInvalidatedOutOfUpdate(true)
268 KY_INLINE SpatializedPoint::~SpatializedPoint() { Clear(); }
270 KY_INLINE
const DatabaseBinding* SpatializedPoint::GetDatabaseBinding()
const {
return m_pointSpatialization.m_databaseBinding; }
271 KY_INLINE
KyUInt32 SpatializedPoint::GetDbSpatializationCount()
const {
return m_pointSpatialization.m_databaseBinding->GetBoundDatabaseCount(); }
272 KY_INLINE
const Vec3f& SpatializedPoint::GetPosition()
const {
return m_position; }
273 KY_INLINE
KyFloat32 SpatializedPoint::GetHeight()
const {
return m_height; }
274 KY_INLINE
void* SpatializedPoint::GetObject()
const {
return m_object; }
276 KY_INLINE
KyUInt32 SpatializedPoint::GetIndexInObject()
const {
return m_indexInObject; }
277 KY_INLINE PointDbSpatialization& SpatializedPoint::GetDbSpatialization(
KyUInt32 boundDatabaseIdx) {
return m_pointSpatialization.m_pointDbSpatialization[boundDatabaseIdx]; }
278 KY_INLINE
const PointDbSpatialization& SpatializedPoint::GetDbSpatialization(
KyUInt32 boundDatabaseIdx)
const {
return m_pointSpatialization.m_pointDbSpatialization[boundDatabaseIdx]; }
280 KY_INLINE
void SpatializedPoint::SetPosition(
const Vec3f& position) { m_position = position; }
281 KY_INLINE
void SpatializedPoint::SetHeight(
KyFloat32 height) { m_height = height; }
283 KY_INLINE
const PointSpatialization& SpatializedPoint::GetPointSpatialization()
const {
return m_pointSpatialization; }
288 #endif // Navigation_SpatializedPoint_H
CylinderObstacles represent dynamic objects of your game engine that prevent your Bots from moving fr...
Definition: cylinderobstacle.h:87
This class is the world element that represent an active character in Gameware Navigation.
Definition: bot.h:150
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
This class is a runtime wrapper of a NavFloorBlob, it gathers all the runtime information associated ...
Definition: navfloor.h:40
#define KY_NULL
Null value.
Definition: types.h:247
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
Ptr< DatabaseBinding > m_databaseBinding
Defines the Databases in which the SpatializedPoint will be spatialized.
Definition: spatializedpoint.h:158
Class used to initialize a SpatializedPoint.
Definition: spatializedpoint.h:120
This class is a runtime container for all NavData that represents the world from the point of view of...
Definition: database.h:64
DatabaseBinding is a collection of the databases to be used for world elements spatialization.
Definition: databasebinding.h:24
SpatializedPointObjectType
Enumerates the possible object types the SpatializedPoint refers to.
Definition: spatializedpoint.h:35
Definition: gamekitcrowddispersion.h:20
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
Each instance of this class uniquely identifies a single NavTriangle in a NavFloor.
Definition: navtriangleptr.h:22
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
Internal class used for point spatialization in NavData.
Definition: spatializedpoint.h:171
Each instance of the BoxObstacle class represents a dynamic, physical object in your game engine that...
Definition: boxobstacle.h:139
#define KyUInt32MAXVAL
The maximum value that can be stored in the KyUInt32 variable type.
Definition: types.h:226
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