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.

Public Member Functions

KyUInt32 GetDatabaseIndex () const
 
const DatabaseGenMetricsGetDatabaseGenMetrics () const
 
DatabasePositionSpatializationRange & GetDatabasePositionSpatializationRange ()
 
const DatabasePositionSpatializationRange & GetDatabasePositionSpatializationRange () const
 
const PositionSpatializationRange & GetPositionSpatializationRange () const
 
bool IsClear () const
 
bool IsCompatibleWith (const NavData &navData) const
 
void RemoveAllNavData ()
 
KyUInt32 GetAliveNavDataCount () const
 
void RemoveAllBots ()
 
KyUInt32 GetBotsCount () const
 
BotGetBot (KyUInt32 index) const
 
WorkingMemory * GetWorkingMemory () const
 
const CellBoxGetLastUpdateCellBox () const
 
bool HasChangedLastFrame () const
 

For internal use only

KyUInt32 m_navdataChangeIdx
 
KyUInt32 m_frameIdx
 
CellBox m_lastUpdateBox
 
DatabasePositionSpatializationRange m_positionSpatializationRange
 
DatabaseGenMetrics m_generationMetrics
 
ActiveDatam_activeData
 
NavCellGridm_navCellGrid
 
NavMeshElementManagerm_navMeshElementManager
 
NavGraphManager * m_navGraphManager
 
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
 
Collection< Ptr< BaseBlobHandler > > m_visualDebugBlobCollection
 
 Database (World *world, KyUInt32 databaseIndex)
 
virtual ~Database ()
 
void Clear ()
 
virtual void DoSendVisualDebug (VisualDebugServer &visualDebugServer, VisualDebugSendChangeEvent changeEvent)
 
PerformQueryStatisticsGetPerformQueryStatistics ()
 
void SetEventBroadcaster (IDatabaseChangeBroadcaster *eventBroadCaster)
 
void UpdateImmediate ()
 

Internally used by the NavigationLab for Database Visual Representation

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.

void SetVisualGeometryFactory (Ptr< IVisualGeometryFactory > factory)
 
void SetVisualGeometry (Ptr< IVisualGeometry > geometry)
 
void BuildVisualGeometry (bool forceRebuildAll=false)
 
void BuildVisualGeometry (Ptr< IVisualGeometry > geometry, const DatabaseVisualGeometryBuilderConfig &config=DatabaseVisualGeometryBuilderConfig())
 
DatabaseGeometryBuildingManager & GetDatabaseGeometryBuildingManager ()
 
IVisualGeometryGetVisualGeometry () const
 

Called by various components, World, Queries

ActiveDataGetActiveData () const
 
bool IsThereNavDataToBeAddedOrRemoved () const
 
bool IsDatabaseUpdatingNavData () const
 
void UpdateWithDynamicNavFloors (const CellBox &enlargeUpdateCellBox)
 
void RecomputeAllTriangleCostMapInBox (const CellBox &enlargeUpdateCellBox)
 
void TakeSnapshotAndPrepareActiveDataUpdate (QueryProcessMode processMode)
 
void UpdateActiveDataAndClearSnapshot ()
 
void UpdateBotsPathFollowing (KyFloat32 simulationTimeInSeconds)
 
void UpdateBotsGenMetrics ()
 
KyUInt32 GetRayCanGoMarginInt (RayCanGoMarginMode marginMode)
 
KyFloat32 GetRayCanGoMarginFloat (RayCanGoMarginMode marginMode)
 
void SetupGenerationMetrics (const NavMeshGenParameters &navMeshGenParameters)
 

Main API Functions

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

Visual Debug

void SetCurrentVisualDebugLOD (VisualDebugLOD lod)
 
VisualDebugLOD GetCurrentVisualDebugLOD () const
 
VisualDebugLOD GetPreviousVisualDebugLod () const
 
void SendVisualDebug (VisualDebugServer &server)
 
void ForceSendAllVisualDebug ()
 

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 ( )
inherited

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.

const CellBox & Kaim::Database::GetLastUpdateCellBox ( ) const
inline

Returns a CellBox covering all NavData that has been changed on last World::Update().

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

Return statistics on queries called on this Database.

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

Retrieves the instance of IVisualGeometry to which this object sends its triangles for rendering set Using SetVisualGeometry() or KY_NULL 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::HasChangedLastFrame ( ) const
inline

Returns true when something has changed on last World::Update().

This is useful when you want to maintain some information on your own that is based on some NavData element. You can then call GetLastUpdateCellBox() to retrieve the overall CellBox concerned by last changes.

+ 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::RemoveAllNavData ( )

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

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

bookeeping, 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 ot be send during the DoSendVisualDebug call.


The documentation for this class was generated from the following file: