10 #ifndef Navigation_Database_H
11 #define Navigation_Database_H
28 class AbstractGraphCellGrid;
29 class NavMeshGenParameters;
30 class NavMeshElementManager;
31 class NavGraphManager;
32 class ITriangleCostMap;
51 RayCanGoMarginModeCount
62 class Database :
public WorldElement
70 virtual const char* GetTypeName()
const {
return "Database"; }
81 DatabasePositionSpatializationRange& GetDatabasePositionSpatializationRange();
82 const DatabasePositionSpatializationRange& GetDatabasePositionSpatializationRange()
const;
83 const PositionSpatializationRange& GetPositionSpatializationRange()
const;
98 KyUInt32 GetAliveNavDataCount()
const;
100 void RemoveAllBots();
118 Database(World* world,
KyUInt32 databaseIndex);
123 virtual void DoSendVisualDebug(VisualDebugServer& visualDebugServer, VisualDebugSendChangeEvent changeEvent);
129 void SetEventBroadcaster(IDatabaseChangeBroadcaster* eventBroadCaster);
130 void UpdateImmediate();
154 void BuildVisualGeometry(Ptr<IVisualGeometry> geometry,
const DatabaseVisualGeometryBuilderConfig& config = DatabaseVisualGeometryBuilderConfig());
166 ActiveData* GetActiveData()
const;
168 bool IsThereNavDataToBeAddedOrRemoved()
const;
169 bool IsDatabaseUpdatingNavData()
const;
171 void UpdateWithDynamicNavFloors(
const CellBox& enlargeUpdateCellBox);
173 void RecomputeAllTriangleCostMapInBox(
const CellBox& enlargeUpdateCellBox);
175 void TakeSnapshotAndPrepareActiveDataUpdate(QueryProcessMode processMode);
176 void UpdateActiveDataAndClearSnapshot();
177 void UpdateBotsPathFollowing(
KyFloat32 simulationTimeInSeconds);
178 void UpdateBotsGenMetrics();
183 void SetupGenerationMetrics(
const NavMeshGenParameters& navMeshGenParameters);
186 friend class DatabaseUpdateManager;
187 friend class NavMeshElementManager;
188 void IncrementNavDataChangeIndex();
190 void RemoveNavGraphsOfNavDataBeeingRemoved();
191 void AddNavGraphsOfNavDataBeeingAdded();
193 void SnapShotOfNavDataToUpdate();
194 void ClearSnapShotOfNavDataToUpdate();
196 void PrepareNavMeshInsertionOfNavDataBeeingAdded();
197 void PrepareNavMeshRemovalOfNavDataBeeingRemoved();
198 void RemoveNavMeshOfNavDataBeeingRemoved();
200 void ComputeCellNextActiveNessStatus(QueryProcessMode queryProcessMode);
201 void UpdateStitchOneToOneAndLaunchRuntimeStitchQueries(QueryProcessMode queryProcessMode);
202 void UpdateActiveData();
204 void PrepareAbstractGraphInsertionOfNavDataBeeingAdded();
205 void InsertAbstractGraphOfNavDataBeeingAdded();
206 void RemoveAbstractGraphOfNavDataBeeingRemoved();
208 void ForceSendAllDynamicFloorsAtCellPos(VisualDebugServer &visualDebugServer);
210 enum CompatibilityStatus
212 Compatibility_Untested,
214 Compatibility_Success,
216 CompatibilityStatus
IsCompatibleWith(
const NavData& navData,
const TrackedCollection<Ptr<NavData>, MemStat_WorldFwk>& navDataCollection)
const;
223 DatabasePositionSpatializationRange m_positionSpatializationRange;
230 AbstractGraphCellGrid* m_abstractGraphCellGrid;
231 WorkingMemory* m_workingMemory;
233 TrackedCollection<Ptr<Bot>, MemStat_WorldFwk> m_bots;
235 TrackedCollection<Ptr<ITriangleCostMap>, MemStat_WorldFwk> m_triangleCostMaps;
237 TrackedCollection<Ptr<NavData>, MemStat_WorldFwk> m_navDataToBeAdded;
238 TrackedCollection<Ptr<NavData>, MemStat_WorldFwk> m_navDataBeeingAdded;
239 TrackedCollection<Ptr<NavData>, MemStat_WorldFwk> m_navDatas;
240 TrackedCollection<Ptr<NavData>, MemStat_WorldFwk> m_navDataToBeRemoved;
241 TrackedCollection<Ptr<NavData>, MemStat_WorldFwk> m_navDataBeeingRemoved;
243 Ptr<IDatabaseChangeBroadcaster> m_eventBroadCaster;
245 DatabaseGeometryBuildingManager m_geometryBuildingManager;
256 CellBox m_currentNavMeshUpdateCellBox;
257 CellBox m_currentNavGraphUpdateCellBox;
258 CellBox m_currentAbstractGraphUpdateCellBox;
259 KyUInt32 m_navDataWithNavMeshElementCount;
260 KyUInt32 m_navDataWithAbstractGraphCount;
265 KY_INLINE
KyUInt32 Database::GetBotsCount()
const {
return m_bots.GetCount(); }
266 KY_INLINE Bot* Database::GetBot(
KyUInt32 index)
const {
return m_bots[index]; }
268 KY_INLINE ActiveData* Database::GetActiveData()
const {
return m_activeData; }
272 KY_INLINE
bool Database::IsThereNavDataToBeAddedOrRemoved()
const {
return m_navDataToBeAdded.GetCount() + m_navDataToBeRemoved.GetCount() != 0; }
273 KY_INLINE
bool Database::IsDatabaseUpdatingNavData()
const {
return m_navDataBeeingAdded.GetCount() + m_navDataBeeingRemoved.GetCount() != 0; }
274 KY_INLINE
KyUInt32 Database::GetAliveNavDataCount()
const {
return m_navDatas.GetCount() + m_navDataToBeRemoved.GetCount() + m_navDataBeeingRemoved.GetCount(); }
278 KY_INLINE
const DatabasePositionSpatializationRange& Database::GetDatabasePositionSpatializationRange()
const {
return m_positionSpatializationRange; }
279 KY_INLINE DatabasePositionSpatializationRange& Database::GetDatabasePositionSpatializationRange() {
return m_positionSpatializationRange; }
280 KY_INLINE
const PositionSpatializationRange& Database::GetPositionSpatializationRange()
const {
return m_positionSpatializationRange.GetPositionSpatializationRange(); }
286 KY_INLINE
void Database::IncrementNavDataChangeIndex() { m_navdataChangeIdx = m_navdataChangeIdx !=
KyUInt32MAXVAL ? m_navdataChangeIdx + 1 : 1; }
292 static const KyUInt32 marginValues[RayCanGoMarginModeCount] = {
301 return marginValues[rayCanGoMarginMode];
313 #endif // Navigation_Database_H
Margin to be used when computing the DiagonalStrip used for Channel computation.
Definition: database.h:44
void SetVisualGeometryFactory(Ptr< IVisualGeometryFactory > factory)
Sets the instance of IVisualGeometryFactory that will be used by the DatabaseGeometryBuildingManager ...
Definition: database.h:309
PerformQueryStatistics * GetPerformQueryStatistics()
Return statistics on queries called on this Database.
Definition: database.h:334
NavCellGrid * m_navCellGrid
bookeeping, stitching, spatialization, NavCells version management, ...
Definition: database.h:251
const DatabaseGenMetrics & GetDatabaseGenMetrics() const
Retrieves the DatabaseGenMetrics, which offers services for converting between floating-point coordin...
Definition: database.h:302
Collection< Ptr< BaseBlobHandler > > m_visualDebugBlobCollection
(VisualDebug) store the blob ot be send during the DoSendVisualDebug call.
Definition: database.h:272
This class represents a two-dimensional axis-aligned bounding box whose dimensions are stored using 3...
Definition: box2i.h:119
Box2i CellBox
A type that represents a bounding box around cells in a 2D grid.
Definition: navmeshtypes.h:34
bool m_needToSendActiveNavData
(VisualDebug) Avoids sending all the active NavData each frame. Accessed by the NavCellGrid.
Definition: database.h:271
DatabaseGeometryBuildingManager & GetDatabaseGeometryBuildingManager()
Retrieves the instance of the DatabaseGeometryBuildingManager maintained by this object, which manage the tiling of DatabaseVisualGeometryBuilder.
Definition: database.h:301
bool IsClear() const
Returns true if the Database is not associated to any set of generation parameters.
Definition: database.h:288
Collection is a class which is a "Collection" of elements (not sorted, not unique) ...
Definition: collection.h:32
KyUInt32 GetDatabaseIndex() const
Retrieves the index of the Database in the array of Databases maintained by the World.
Definition: database.h:289
ActiveData * m_activeData
all the data that are active
Definition: database.h:250
WorkingMemory * GetWorkingMemory() const
The WorkingMemory used by default by Queries when processed outside a QueryQueue. You should not need...
Definition: database.h:292
void RemoveAllNavData()
Remove all the NavData from this Database.
DatabaseGenMetrics m_generationMetrics
generation parameters. Set by the NavMeshElementManager. Do Not Modify
Definition: database.h:248
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
Margin to be used in any path computation ray can go queries to ensure the computed Path is not too c...
Definition: database.h:46
NavGraphManager * m_navGraphManager
NavGraph container.
Definition: database.h:253
Margin to be used in MoveOnNavMesh or any other actual movement computation.
Definition: database.h:49
This class is a runtime container for all NavData that represents the world from the point of view of...
Definition: database.h:64
RayCanGoMarginMode
Defines the different mode for the NavMesh border margin to be used in RayCanGo queries.
Definition: database.h:41
WorldElementType
Enumerates the WorldElement types.
Definition: worldelementtype.h:15
IVisualGeometry * GetVisualGeometry() const
Retrieves the instance of IVisualGeometry to which this object sends its triangles for rendering set ...
Definition: database.h:307
Definition: gamekitcrowddispersion.h:20
Margin to be used to get ray can go exactly on the NavMesh borders.
Definition: database.h:43
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
KyFloat32 m_integerPrecision
For internal use. Do not modify.
Definition: databasegenmetrics.h:182
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
const CellBox & GetLastUpdateCellBox() const
Returns a CellBox covering all NavData that has been changed on last World::Update().
Definition: database.h:294
Margin to be used in any path following ray can go queries to ensure the computed trajectory is not t...
Definition: database.h:47
void SetVisualGeometry(Ptr< IVisualGeometry > geometry)
Sets the instance of IVisualGeometry to which this object will send its triangles for rendering when ...
Definition: database.h:310
void Clear()
internal, use World::ClearDatabase(KyUInt32 databaseIndex). RemoveAll navData, bots, clear memory of cell grid, activeData and GenerationMetrics
NavMeshElementManager * m_navMeshElementManager
NavMesh container + GUID manager/sorter.
Definition: database.h:252
bool IsValid() const
Indicates whether or not the extents of the bounding box are valid.
Definition: box2i.h:154
bool IsCompatibleWith(const NavData &navData) const
Indicates whether or not the specified NavData object was created with the same generation parameters...
bool HasChangedLastFrame() const
Returns true when something has changed on last World::Update().
Definition: database.h:295
Margin to be used for Channel computation.
Definition: database.h:45
Margin to be used only to reevaluate a trajectory previously validated with can go using IdealTraject...
Definition: database.h:48
#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
void BuildVisualGeometry(bool forceRebuildAll=false)
Sends to the IVisualGeometry or to the IVisualGeometry of the DatabaseGeometryBuildingManager (depend...
Definition: database.h:313