Kaim::Database Class Reference

Kaim::Database Class Reference

#include <database.h>

Class Description

This class is a runtime container for all NavData that represents the world from the point of view of a specific type of Bots.

Databases are created once and for all during the World construction. Through some sub-classes (NavMeshElementManager, NavGraphManager, NavCellGrid, ...), the Database performs the additions and removals of NavData, maintaining a coherent state of "active" navigable data on which Bots are moving, Queries are performed, in term of overlaps, dynamic version of NavFloors, stitching of the NavCells, etc... The Database also maintains an instance of WorkingMemory, which is used by default by the Queries that are not processed within a QueryQueue.

+ Examples:

Inherits Kaim::WorldElement.

Functions

KyUInt32 GetDatabaseIndex () const
 Retrieves the index of the Database in the array of Databases maintained by the World. More...
 
const DatabaseGenMetricsGetDatabaseGenMetrics () const
 Retrieves the DatabaseGenMetrics, which offers services for converting between floating-point coordinates and the integer coordinate system used internally by the NavData. More...
 
DatabasePositionSpatializationRange & GetDatabasePositionSpatializationRange ()
 
const DatabasePositionSpatializationRange & GetDatabasePositionSpatializationRange () const
 
const PositionSpatializationRangeGetPositionSpatializationRange () const
 
KyResult SetSpatializationRange (KyFloat32 abovePosition, KyFloat32 belowPosition)
 
bool IsClear () const
 Returns true if the Database is not associated to any set of generation parameters. More...
 
bool IsCompatibleWith (const NavData &navData) const
 Indicates whether or not the specified NavData object was created with the same generation parameters as the NavData objects that have already been loaded into this Database so that it can be added too. More...
 
void RemoveAllNavDataImmediate ()
 Remove all the NavData from this Database. More...
 
KyUInt32 GetAliveNavDataCount () const
 
void RemoveAllBots ()
 
KyUInt32 GetBotsCount () const
 
BotGetBot (KyUInt32 index) const
 
WorkingMemory * GetWorkingMemory () const
 The WorkingMemory used by default by Queries when processed outside a QueryQueue. You should not need. More...
 
DisplayListManagerGetDisplayListManager () const
 Get the DisplayListManager that is required when creating a DisplayList. More...
 
VisualDebugServer * GetVisualDebugServer () const
 Get the VisualDebugServer. More...
 
const DatabaseChange & GetChangesSinceLastReset () const
 
void ResetLastChanges ()
 
void AddChangeListener (const Ptr< IDatabaseChangeListener > &changeListener)
 
void RemoveChangeListener (const Ptr< IDatabaseChangeListener > &changeListener)
 

For internal use only

KyUInt32 m_frameIdx
 
DatabasePositionSpatializationRange m_positionSpatializationRange
 
DatabaseGenMetrics m_generationMetrics
 generation parameters. Set by the NavMeshElementManager. Do Not Modify More...
 
ActiveDatam_activeData
 all the data that are active More...
 
NavCellGridm_navCellGrid
 bookkeeping, stitching, spatialization, NavCells version management, ... More...
 
NavMeshElementManagerm_navMeshElementManager
 NavMesh container + GUID manager/sorter. More...
 
NavGraphManager * m_navGraphManager
 NavGraph container. More...
 
AbstractGraphCellGrid * m_abstractGraphCellGrid
 
WorkingMemory * m_workingMemory
 
TrackedCollection< Ptr< Bot >, MemStat_WorldFwk > m_bots
 
TrackedCollection< Ptr< ITriangleCostMap >, MemStat_WorldFwk > m_triangleCostMaps
 
TrackedCollection< Ptr< NavData >, MemStat_WorldFwk > m_navDataToBeAdded
 
TrackedCollection< Ptr< NavData >, MemStat_WorldFwk > m_navDataBeeingAdded
 
TrackedCollection< Ptr< NavData >, MemStat_WorldFwk > m_navDatas
 
TrackedCollection< Ptr< NavData >, MemStat_WorldFwk > m_navDataToBeRemoved
 
TrackedCollection< Ptr< NavData >, MemStat_WorldFwk > m_navDataBeeingRemoved
 
Ptr< IDatabaseChangeBroadcaster > m_eventBroadCaster
 
DatabaseGeometryBuildingManager m_geometryBuildingManager
 
bool m_needToSendActiveNavData
 (VisualDebug) Avoids sending all the active NavData each frame. Accessed by the NavCellGrid. More...
 
Collection< Ptr< BaseBlobHandler > > m_visualDebugBlobCollection
 (VisualDebug) store the blob to be send during the DoSendVisualDebug call. More...
 
PerformQueryStatistics * m_queryStatistics
 
KyUInt32 m_databaseIndex
 
DatabaseChangeInProgress m_changeInProgress
 
DatabaseChangeIdx m_activeChangeIdx
 
DatabaseChange m_lastChange
 
Collection< Ptr< IDatabaseChangeListener > > m_databaseChangeListeners
 
 Database (World *world, KyUInt32 databaseIndex)
 
virtual ~Database ()
 
void Clear ()
 internal, use World::ClearDatabase(KyUInt32 databaseIndex). RemoveAll navData, bots, clear memory of cell grid, activeData and GenerationMetrics More...
 
virtual void DoSendVisualDebug (VisualDebugServer &visualDebugServer, VisualDebugSendChangeEvent changeEvent)
 
PerformQueryStatistics * GetPerformQueryStatistics ()
 Return statistics on queries called on this Database. More...
 
void SetEventBroadcaster (IDatabaseChangeBroadcaster *eventBroadCaster)
 
void UpdateImmediate ()
 

Internally used by the NavigationLab for Database Visual Representation

void SetVisualGeometryFactory (Ptr< IVisualGeometryFactory > factory)
 If a IVisualGeometryFactory is provided with SetVisualGeometryFactory(), the database will use a grid of IVisualGeometry that can be independently rebuild when only part of the database change. More...
 
void SetVisualGeometry (Ptr< IVisualGeometry > geometry)
 Sets the instance of IVisualGeometry to which this object will send its triangles for rendering when ComputeVisualGeometry() is called. More...
 
void BuildVisualGeometry (bool forceRebuildAll=false)
 Sends to the IVisualGeometry or to the IVisualGeometry of the DatabaseGeometryBuildingManager (depending on what you provided) a set of triangles that express the data maintained by this object for rendering. More...
 
void BuildVisualGeometry (Ptr< IVisualGeometry > geometry, const DatabaseVisualGeometryBuilderConfig &config=DatabaseVisualGeometryBuilderConfig())
 Sends to the IVisualGeometry provided in the function a set of triangles that express the data maintained. More...
 
DatabaseGeometryBuildingManager & GetDatabaseGeometryBuildingManager ()
 Retrieves the instance of the DatabaseGeometryBuildingManager maintained by this object, which manage the tiling of DatabaseVisualGeometryBuilder. More...
 
IVisualGeometryGetVisualGeometry () const
 Retrieves the instance of IVisualGeometry to which this object sends its triangles for rendering set Using SetVisualGeometry() or nullptr if none has been set. More...
 
IVisualGeometryFactoryGetVisualGeometryFactory () const
 

Called by various components, World, Queries

ActiveDataGetActiveData () const
 
void RecomputeAllTriangleCostMapInBox (const CellBox &cellBox)
 
void StartNavDataAddRemoveUpdate (QueryProcessMode processMode)
 
bool IsThereNavDataAddRemovePending () const
 
bool IsDoingNavDataAddRemoveUpdate () const
 
void FinalizeNavDataAddRemoveUpdate ()
 
void FinalizeTagVolumeIntegrationUpdate (const CellBox &tagVolumeChangeCellBox)
 
void UpdateBotsPathFollowing (KyFloat32 simulationTimeInSeconds)
 
void UpdateBotsGenMetrics ()
 
KyUInt32 GetRayCanGoMarginInt (RayCanGoMarginMode marginMode)
 
KyFloat32 GetRayCanGoMarginFloat (RayCanGoMarginMode marginMode)
 
void SetupGenerationMetrics (const NavMeshGenParameters &navMeshGenParameters)
 
KyUInt32 GetActiveNavMeshChangeIdx () const
 
KyUInt32 GetActiveNavGraphChangeIdx () const
 
KyUInt32 GetActiveAbstractGraphChangeIdx () const
 
KyUInt32 GetActiveDatabaseChangeIdx () const
 

Main API Functions

bool IsAddedToWorld () const
 
WorldGetWorld () const
 
KyUInt32 GetVisualDebugId () const
 
void * GetUserData () const
 
void SetUserData (void *userData)
 

Visual Debug

void SetCurrentVisualDebugLOD (VisualDebugLOD lod)
 Set the visual debug level of details to use for this WorldElement instance. More...
 
VisualDebugLOD GetCurrentVisualDebugLOD () const
 
VisualDebugLOD GetPreviousVisualDebugLod () const
 
void SendVisualDebug (VisualDebugServer &server)
 
void ForceSendAllVisualDebug ()
 Call this when something impacts all your visual debug data. More...
 

For internal use only

void SendForMaxLevelOfDetail (VisualDebugServer &server, const Vec3f &shapePosition)
 
void RegisterToVisualDebug ()
 
void UnRegisterFromVisualDebug ()
 
KyUInt32 GetIndexInCollection () const
 
void SetIndexInCollection (KyUInt32 indexInCollection)
 

Member Function Documentation

void Kaim::Database::BuildVisualGeometry ( bool  forceRebuildAll = false)
inline

Sends to the IVisualGeometry or to the IVisualGeometry of the DatabaseGeometryBuildingManager (depending on what you provided) a set of triangles that express the data maintained by this object for rendering.

+ Examples:
void Kaim::Database::BuildVisualGeometry ( Ptr< IVisualGeometry geometry,
const DatabaseVisualGeometryBuilderConfig &  config = DatabaseVisualGeometryBuilderConfig() 
)

Sends to the IVisualGeometry provided in the function a set of triangles that express the data maintained.

by providing DatabaseVisualGeometryBuilderConfig.

void Kaim::Database::Clear ( )

internal, use World::ClearDatabase(KyUInt32 databaseIndex). RemoveAll navData, bots, clear memory of cell grid, activeData and GenerationMetrics

void Kaim::WorldElement::ForceSendAllVisualDebug ( )
inlineinherited

Call this when something impacts all your visual debug data.

It will set the event to VisualDebugSendChangeEvent_ForceSendAll. (called internally when connecting with a VisualDebug client).

const DatabaseGenMetrics& Kaim::Database::GetDatabaseGenMetrics ( ) const
inline

Retrieves the DatabaseGenMetrics, which offers services for converting between floating-point coordinates and the integer coordinate system used internally by the NavData.

+ Examples:
DatabaseGeometryBuildingManager& Kaim::Database::GetDatabaseGeometryBuildingManager ( )
inline

Retrieves the instance of the DatabaseGeometryBuildingManager maintained by this object, which manage the tiling of DatabaseVisualGeometryBuilder.

KyUInt32 Kaim::Database::GetDatabaseIndex ( ) const
inline

Retrieves the index of the Database in the array of Databases maintained by the World.

DisplayListManager * Kaim::Database::GetDisplayListManager ( ) const

Get the DisplayListManager that is required when creating a DisplayList.

+ Examples:
PerformQueryStatistics* Kaim::Database::GetPerformQueryStatistics ( )
inline

Return statistics on queries called on this Database.

VisualDebugServer * Kaim::Database::GetVisualDebugServer ( ) const

Get the VisualDebugServer.

IVisualGeometry* Kaim::Database::GetVisualGeometry ( ) const
inline

Retrieves the instance of IVisualGeometry to which this object sends its triangles for rendering set Using SetVisualGeometry() or nullptr if none has been set.

WorkingMemory* Kaim::Database::GetWorkingMemory ( ) const
inline

The WorkingMemory used by default by Queries when processed outside a QueryQueue. You should not need.

+ Examples:
bool Kaim::Database::IsClear ( ) const
inline

Returns true if the Database is not associated to any set of generation parameters.

It false is returned, it means that only NavData compatible with current generation parameters can be added. In this case, you can use the function IsCompatibleWith to check that. Note that Databases are cleared only during a call to World::RemoveAndCancellAll()

bool Kaim::Database::IsCompatibleWith ( const NavData navData) const

Indicates whether or not the specified NavData object was created with the same generation parameters as the NavData objects that have already been loaded into this Database so that it can be added too.

void Kaim::Database::RemoveAllNavDataImmediate ( )

Remove all the NavData from this Database.

Precondition
This function cannot be called if the Database in updating
+ Examples:
void Kaim::WorldElement::SetCurrentVisualDebugLOD ( VisualDebugLOD  lod)
inlineinherited

Set the visual debug level of details to use for this WorldElement instance.

Generally, setting this to VisualDebugLOD_Minimal, sends almost nothing but position and status, whereas setting it to VisualDebugLOD_Maximal sends all available debug information including spatialization and some internal algorithm results.

void Kaim::Database::SetVisualGeometry ( Ptr< IVisualGeometry geometry)
inline

Sets the instance of IVisualGeometry to which this object will send its triangles for rendering when ComputeVisualGeometry() is called.

+ Examples:
void Kaim::Database::SetVisualGeometryFactory ( Ptr< IVisualGeometryFactory factory)
inline

If a IVisualGeometryFactory is provided with SetVisualGeometryFactory(), the database will use a grid of IVisualGeometry that can be independently rebuild when only part of the database change.

If no IVisualGeometryFactory has been set, it is still possible to display the all database in only one IVisualGeometry by providing a IVisualGeometry with SetVisualGeometry(). Note that building the IVisualGeometry for all the database can be time consuming in big worlds. Sets the instance of IVisualGeometryFactory that will be used by the DatabaseGeometryBuildingManager to create IVisualGeometry to which this object will send triangles for rendering a tile of the Database

Member Data Documentation

ActiveData* Kaim::Database::m_activeData

all the data that are active

DatabaseGenMetrics Kaim::Database::m_generationMetrics

generation parameters. Set by the NavMeshElementManager. Do Not Modify

NavCellGrid* Kaim::Database::m_navCellGrid

bookkeeping, stitching, spatialization, NavCells version management, ...

NavGraphManager* Kaim::Database::m_navGraphManager

NavGraph container.

NavMeshElementManager* Kaim::Database::m_navMeshElementManager

NavMesh container + GUID manager/sorter.

bool Kaim::Database::m_needToSendActiveNavData

(VisualDebug) Avoids sending all the active NavData each frame. Accessed by the NavCellGrid.

Collection<Ptr<BaseBlobHandler> > Kaim::Database::m_visualDebugBlobCollection

(VisualDebug) store the blob to be send during the DoSendVisualDebug call.


The documentation for this class was generated from the following files:
  • gwnavruntime/database/database.h
  • gwnavruntime/database/database.cpp