VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes
DtVrfNavAreaManager Class Reference

The DtVrfNavAreaManager manages all of the nav areas currently created in the sim.

Classes

struct  navAreaExtentData
 

Public Member Functions

 DtVrfNavAreaManager (DtSimulationServices *manager)
 
virtual ~DtVrfNavAreaManager ()
 
virtual bool init ()
 
virtual void tick ()
 
virtual void unloadAllNavData ()
 
virtual void revertNavData ()
 
virtual void pauseNavDataRegeneration ()
 
virtual void resumeNavDataRegeneration ()
 
virtual void addNavArea (DtNavArea *a)
 
virtual DtNavArealoadNavArea (DtNavArea::NavAreaId id, const DtFilename &filename)
 
virtual DtNavArealoadNavDataForObject (DtNavArea::NavAreaId id, const DtFilename &filename, const DtSimObject *simObject, const DtReaderWriter::SearchPaths &searchPaths=DtReaderWriter::SearchPaths())
 
virtual void loadAllNavData (bool *dataAvailable=0)
 
virtual DtNavArea::NavAreaId nextNavAreaId ()
 
virtual void addNavAreaAboutToBeRemovedCallback (DtNavAreaRemovalCallbackFcn fcn, void *usrData) const
 
virtual void removeNavAreaAboutToBeRemovedCallback (DtNavAreaRemovalCallbackFcn fcn, void *usrData) const
 
virtual void setBlockingNavDataLoad (bool b)
 
virtual void sendNavDataStatus ()
 
virtual void processNavQueues ()
 
virtual void processSimObjectDeleted (const DtSimObject *simObject)
 
virtual void invokeAreaAboutToBeDeletedCallbacks (DtNavArea *)
 
void processUnloadTerrain ()
 
virtual void updateSimOperationStatus ()
 
void setBlockOnAsynchronousOperations (bool block)
 
bool hasAsynchronousOperationsPending () const
 
virtual void setTerrainInterface (DtTerrainInterface *terrainInterface)
 
virtual DtTerrainInterfaceterrainInterface ()
 
void loadObjectNavData (const DtSimObject *simObject, const DtReaderWriter::SearchPaths &searchPaths=DtReaderWriter::SearchPaths())
 
void removeObjectNavData (const DtSimObject *simObject)
 
DtNavAreaareaForObject (const DtSimObject *simObject) const
 
virtual DtNavAreafindNavAreaForLocation (const DtVector &localPosition, const DtString &profile, const DtSimObject *=0, bool *dataAvailable=0)
 
virtual std::vector< DtNavArea * > findNavAreasForLocation (const DtVector &localPosition, const DtString &profile, DtTerrainCategoryMask terrainCategoryMask, const DtSimObject *=0, bool *dataAvailable=0, const DtAttachedTerrain *terrainAttachedTo=0, bool loadNavAreas=true)
 
virtual std::vector< DtNavArea * > findNavAreasForArea (const DtLocalVertexList *boundingArea, const DtString &profile, const DtSimObject *=0, bool *dataAvailable=0)
 
virtual DtNavAreafindNavAreaForArea (const DtLocalVertexList *area, const DtString &profile, const DtSimObject *=0, bool *dataAvailable=0)
 
virtual std::vector< DtNavArea * > findNavAreasForLocation (const DtVector &localPosition) const
 

Static Public Member Functions

static void tickCallback (void *args)
 
static void setGamewareWorkingMemorySize (int sizeInMb)
 
static void setRegenerateNavigationDataAtRuntime (bool regen)
 
static void setMaxRegenerationThreads (int threads)
 
static void setNumberOfNavQueueProcessingThreads (int threads)
 
static void setRegenerationDelay (double delay)
 
static void setQueryTimeBudget (double ms)
 
static void setRegenerationFileDirectory (const DtFilename &dir)
 

Public Attributes

DtNavGenerationThreadCountermyNavGenThreadCounter
 

Static Public Attributes

static int theGamewareWorkingMemorySize
 
static bool theRegenerateNavDataAtRuntime
 
static int theMaxRegenerationThreads
 
static int theNumberOfNavQueueProcessingThreads
 
static double theRegenerationDelay
 
static double theQueryTimeBudget
 
static DtFilename theRegenerationFileDirectory
 

Protected Types

typedef std::vector< DtNavArea * > DtNavAreas
 
typedef std::map< DtUUID,
DtNavArea * > 
DtObjectNavAreaMap
 
typedef std::queue
< DtTerrainChangeNotificationInfo
DtNavAreaTerrainChangesQueue
 
typedef std::map
< DtNavArea::NavAreaId,
DtNavAreaTerrainChangesQueue * > 
DtNavAreasTerrainChangesQueues
 
typedef std::map
< DtNavArea::NavAreaId,
DtExtent
DtNavAreasLocalExtents
 
typedef DtCallbackList
< DtNavArea * > 
NavAreaAboutToBeRemovedList
 

Protected Member Functions

virtual void processNavAreasTerrainChangesQueues ()
 

Protected Attributes

DtTerrainInterfacemyTerrainInterface
 
std::map< DtNavArea::NavAreaId,
navAreaExtentData
myNavAreaExtents
 
DtNavAreas myNavAreas
 
DtObjectNavAreaMap myObjectNavAreas
 
DtNavAreasTerrainChangesQueues myNavAreasTerrainChangesQueues
 
DtNavAreasLocalExtents myNavAreasLocalExtents
 
bool myRegisteredForTerrainChanges
 
bool myNavigationInitialized
 
DtSimulationServicesmySimulationServices
 
Coordinate_SystemmyObjectCoordSys
 
bool myBlockingNavLoad
 
DtNavArea::NavAreaId myNextNavAreaId
 
NavAreaAboutToBeRemovedList myNavAreaAboutToRemRemovedList
 
tbb::spin_mutex myNavAreaExtentsMutex
 
tbb::spin_rw_mutex myNavAreaMutex
 
tbb::spin_rw_mutex myObjectNavAreaMutex
 
DtVrfCallbackQueuemyNavQueryProcessingParallelQueue
 
std::atomic< boolmyContinueProcessing
 
std::atomic< boolmyProcessingStopped
 
tbb::task_arena myNavAreaArena
 
tbb::task_group myNavAreaTaskGroup
 
boost::signals2::connection myUnloadTerrainConnection
 
bool myRegenInTempDirectory
 
bool myNavRegenerating = false
 
bool myNavOperations = false
 
virtual void processGenericRecordLoaded (makArchives::DtGenericTerrainRecord *record)
 
static void genericRecordLoadedCallback (makArchives::DtGenericTerrainRecord *record, void *user)
 
virtual void processRequestNavAreaStatus ()
 
static void requestNavAreaStatusCallback (DtSimMessage *, void *usr)
 
virtual void processRequestSimObjectDebugPortsCallback (DtUUID uuid)
 
static void requestSimObjectDebugPortsCallback (DtSimMessage *msg, void *usr)
 
virtual void processNavigationRegenUpdate ()
 
static void navigationRegenUpdateCallback (void *usr)
 
static void terainChangeNotificationCallback (const DtTerrainChangeNotificationInfo &terrainChangeInfo, void *usr)
 
void processTerrainChangeNotification (const DtTerrainChangeNotificationInfo &terrainChangeInfo)
 

Member Typedef Documentation

typedef std::vector<DtNavArea*> DtVrfNavAreaManager::DtNavAreas
protected

Constructor & Destructor Documentation

DtVrfNavAreaManager::DtVrfNavAreaManager ( DtSimulationServices manager)
virtual DtVrfNavAreaManager::~DtVrfNavAreaManager ( )
virtual

destructor

Member Function Documentation

static void DtVrfNavAreaManager::tickCallback ( void *  args)
static
virtual bool DtVrfNavAreaManager::init ( )
virtual

Registers a callback on DtIfRequestNavAreaDebugPorts messages.

virtual void DtVrfNavAreaManager::tick ( )
virtual

Ticks each nav area, in parallel unless configured otherwise.

virtual void DtVrfNavAreaManager::setTerrainInterface ( DtTerrainInterface terrainInterface)
virtual

The terrain interface used by this nav area manager.

virtual DtTerrainInterface* DtVrfNavAreaManager::terrainInterface ( )
inlinevirtual

The terrain interface used by this nav area manager.

static void DtVrfNavAreaManager::genericRecordLoadedCallback ( makArchives::DtGenericTerrainRecord record,
void *  user 
)
static

Callback to processes terrain records indicating nav areas to be loaded. Prepares the area for loading when first requested.

virtual void DtVrfNavAreaManager::processGenericRecordLoaded ( makArchives::DtGenericTerrainRecord record)
virtual

Callback to processes terrain records indicating nav areas to be loaded. Prepares the area for loading when first requested.

void DtVrfNavAreaManager::loadObjectNavData ( const DtSimObject simObject,
const DtReaderWriter::SearchPaths searchPaths = DtReaderWriter::SearchPaths() 
)

Manage nav data attached to entities, such as ships or other large objects that can be traversed by smaller entities.

void DtVrfNavAreaManager::removeObjectNavData ( const DtSimObject simObject)

Manage nav data attached to entities, such as ships or other large objects that can be traversed by smaller entities.

DtNavArea* DtVrfNavAreaManager::areaForObject ( const DtSimObject simObject) const

Manage nav data attached to entities, such as ships or other large objects that can be traversed by smaller entities.

virtual void DtVrfNavAreaManager::unloadAllNavData ( )
virtual

Clears all nav areas from the manager. Used when the terrain is being closed.

virtual void DtVrfNavAreaManager::revertNavData ( )
virtual

Reverts all loaded nav data to defaults.

virtual void DtVrfNavAreaManager::pauseNavDataRegeneration ( )
virtual

Pauses all nav data regeneration until resumeNavDataRegeneration() is called.

virtual void DtVrfNavAreaManager::resumeNavDataRegeneration ( )
virtual

Resumes nav data regeneration if paused.

virtual void DtVrfNavAreaManager::addNavArea ( DtNavArea a)
virtual

Called after loading the data for a nav area. Does not actually load any data, just gives ownership to the manager. Typically only called internally.

virtual DtNavArea* DtVrfNavAreaManager::loadNavArea ( DtNavArea::NavAreaId  id,
const DtFilename &  filename 
)
virtual

Loads nav data for an area from the given file, assigns it the given id, and then calls addNavArea to add it to the manager. Typically only called internally.

virtual DtNavArea* DtVrfNavAreaManager::loadNavDataForObject ( DtNavArea::NavAreaId  id,
const DtFilename &  filename,
const DtSimObject simObject,
const DtReaderWriter::SearchPaths searchPaths = DtReaderWriter::SearchPaths() 
)
virtual

Loads nav data for an area on a sim object from the given file, assigns it the given id, and then calls addNavArea to add it to the manager. Typically only called internally.

virtual void DtVrfNavAreaManager::loadAllNavData ( bool dataAvailable = 0)
virtual

Loads all nav data (if any). Typically only called internally.

virtual DtNavArea::NavAreaId DtVrfNavAreaManager::nextNavAreaId ( )
virtual

Returns a new unique nav area id. Typically only called internally.

virtual DtNavArea* DtVrfNavAreaManager::findNavAreaForLocation ( const DtVector &  localPosition,
const DtString profile,
const DtSimObject = 0,
bool dataAvailable = 0 
)
virtual

Returns the nav area (if any) that contains a given location and matches the specified profile. The profile must be the name of a valid profile defined in navigationProfiles.mtl. Standard profile names are "lifeform" and "ground-platform". If there is a parentObject, only nav areas that are attached to parentObject are considered. If parentObject is null, then nav areas on the terrain are considered. If the profile is a null string, nav areas for all profiles are considered to be matching.

Parameters
loadNavAreasIf true, any unloaded nav areas that overlap this location will be loaded.
virtual std::vector<DtNavArea*> DtVrfNavAreaManager::findNavAreasForLocation ( const DtVector &  localPosition,
const DtString profile,
DtTerrainCategoryMask  terrainCategoryMask,
const DtSimObject = 0,
bool dataAvailable = 0,
const DtAttachedTerrain terrainAttachedTo = 0,
bool  loadNavAreas = true 
)
virtual

Returns the nav area (if any) that contains a given location and matches the specified profile. The profile must be the name of a valid profile defined in navigationProfiles.mtl. Standard profile names are "lifeform" and "ground-platform". If there is a parentObject, only nav areas that are attached to parentObject are considered. If parentObject is null, then nav areas on the terrain are considered. If the profile is a null string, nav areas for all profiles are considered to be matching.

Parameters
loadNavAreasIf true, any unloaded nav areas that overlap this location will be loaded.
virtual std::vector<DtNavArea*> DtVrfNavAreaManager::findNavAreasForArea ( const DtLocalVertexList boundingArea,
const DtString profile,
const DtSimObject = 0,
bool dataAvailable = 0 
)
virtual

Returns the nav area (if any) that contains a given location and matches the specified profile. The profile must be the name of a valid profile defined in navigationProfiles.mtl. Standard profile names are "lifeform" and "ground-platform". If there is a parentObject, only nav areas that are attached to parentObject are considered. If parentObject is null, then nav areas on the terrain are considered. If the profile is a null string, nav areas for all profiles are considered to be matching.

Parameters
loadNavAreasIf true, any unloaded nav areas that overlap this location will be loaded.
virtual DtNavArea* DtVrfNavAreaManager::findNavAreaForArea ( const DtLocalVertexList area,
const DtString profile,
const DtSimObject = 0,
bool dataAvailable = 0 
)
virtual

Returns the nav area (if any) that contains a given location and matches the specified profile. The profile must be the name of a valid profile defined in navigationProfiles.mtl. Standard profile names are "lifeform" and "ground-platform". If there is a parentObject, only nav areas that are attached to parentObject are considered. If parentObject is null, then nav areas on the terrain are considered. If the profile is a null string, nav areas for all profiles are considered to be matching.

Parameters
loadNavAreasIf true, any unloaded nav areas that overlap this location will be loaded.
virtual std::vector<DtNavArea*> DtVrfNavAreaManager::findNavAreasForLocation ( const DtVector &  localPosition) const
virtual

Will only check currently loaded nav areas and will return regardless of matching profile.

virtual void DtVrfNavAreaManager::addNavAreaAboutToBeRemovedCallback ( DtNavAreaRemovalCallbackFcn  fcn,
void *  usrData 
) const
virtual

Add a callback for when a nav area is about to be removed.

virtual void DtVrfNavAreaManager::removeNavAreaAboutToBeRemovedCallback ( DtNavAreaRemovalCallbackFcn  fcn,
void *  usrData 
) const
virtual

Remove a previously registered callback for notification when a new area is about to be removed.

virtual void DtVrfNavAreaManager::setBlockingNavDataLoad ( bool  b)
virtual

If set to true, nav data loading blocks and loads immediately. Otherwise, nav data loading occurs in a separate thread and may not be immediately available on request.

static void DtVrfNavAreaManager::requestNavAreaStatusCallback ( DtSimMessage ,
void *  usr 
)
static

If navArea debugging is on, sends debug info for all navAreas.

virtual void DtVrfNavAreaManager::processRequestNavAreaStatus ( )
virtual

If navArea debugging is on, sends debug info for all navAreas.

static void DtVrfNavAreaManager::requestSimObjectDebugPortsCallback ( DtSimMessage msg,
void *  usr 
)
static

Callback to processes a request for the nav debug ports.

virtual void DtVrfNavAreaManager::processRequestSimObjectDebugPortsCallback ( DtUUID  uuid)
virtual

Callback to processes a request for the nav debug ports.

virtual void DtVrfNavAreaManager::sendNavDataStatus ( )
virtual

Sends the current nav data status.

virtual void DtVrfNavAreaManager::processNavQueues ( )
virtual

Should only be called by the parallel nav queue processing threads.

static void DtVrfNavAreaManager::setGamewareWorkingMemorySize ( int  sizeInMb)
static

Set navigation configuration.

static void DtVrfNavAreaManager::setRegenerateNavigationDataAtRuntime ( bool  regen)
static

Set navigation configuration.

static void DtVrfNavAreaManager::setMaxRegenerationThreads ( int  threads)
static

Set navigation configuration.

static void DtVrfNavAreaManager::setNumberOfNavQueueProcessingThreads ( int  threads)
static

Set navigation configuration.

static void DtVrfNavAreaManager::setRegenerationDelay ( double  delay)
static

Set navigation configuration.

static void DtVrfNavAreaManager::setQueryTimeBudget ( double  ms)
static

Set navigation configuration.

static void DtVrfNavAreaManager::setRegenerationFileDirectory ( const DtFilename &  dir)
static

Set navigation configuration.

virtual void DtVrfNavAreaManager::processSimObjectDeleted ( const DtSimObject simObject)
virtual

Processes the deletion of a sim object that has its own nav data.

virtual void DtVrfNavAreaManager::invokeAreaAboutToBeDeletedCallbacks ( DtNavArea )
virtual

Invoke callbacks when a nav area is removed.

static void DtVrfNavAreaManager::navigationRegenUpdateCallback ( void *  usr)
static

Callback to send status on navigation regeneration.

virtual void DtVrfNavAreaManager::processNavigationRegenUpdate ( )
virtual

Callback to send status on navigation regeneration.

void DtVrfNavAreaManager::processUnloadTerrain ( )
virtual void DtVrfNavAreaManager::updateSimOperationStatus ( )
virtual
void DtVrfNavAreaManager::setBlockOnAsynchronousOperations ( bool  block)
bool DtVrfNavAreaManager::hasAsynchronousOperationsPending ( ) const
static void DtVrfNavAreaManager::terainChangeNotificationCallback ( const DtTerrainChangeNotificationInfo terrainChangeInfo,
void *  usr 
)
staticprotected

Callback for terrain change notifications. Processes a dynamic terrain change, triggering nav data regeneration if necessary. The terrain changes are added to queues for each nav area. They are processed when the nav area gets loaded.

Parameters
terrainChangeInfo- provides the info for the terrain change - i.e. spatial extent, type of the change
usrthis
void DtVrfNavAreaManager::processTerrainChangeNotification ( const DtTerrainChangeNotificationInfo terrainChangeInfo)
protected

Callback for terrain change notifications. Processes a dynamic terrain change, triggering nav data regeneration if necessary. The terrain changes are added to queues for each nav area. They are processed when the nav area gets loaded.

Parameters
terrainChangeInfo- provides the info for the terrain change - i.e. spatial extent, type of the change
usrthis
virtual void DtVrfNavAreaManager::processNavAreasTerrainChangesQueues ( )
protectedvirtual

Pass the terrain changes to the loaded nav areas.

Member Data Documentation

int DtVrfNavAreaManager::theGamewareWorkingMemorySize
static
bool DtVrfNavAreaManager::theRegenerateNavDataAtRuntime
static
int DtVrfNavAreaManager::theMaxRegenerationThreads
static
int DtVrfNavAreaManager::theNumberOfNavQueueProcessingThreads
static
double DtVrfNavAreaManager::theRegenerationDelay
static
double DtVrfNavAreaManager::theQueryTimeBudget
static
DtFilename DtVrfNavAreaManager::theRegenerationFileDirectory
static
DtTerrainInterface* DtVrfNavAreaManager::myTerrainInterface
protected
std::map<DtNavArea::NavAreaId, navAreaExtentData> DtVrfNavAreaManager::myNavAreaExtents
protected
DtNavAreas DtVrfNavAreaManager::myNavAreas
protected
DtObjectNavAreaMap DtVrfNavAreaManager::myObjectNavAreas
protected
DtNavAreasTerrainChangesQueues DtVrfNavAreaManager::myNavAreasTerrainChangesQueues
protected

Map of queues with terrain changes - created for each nav area. The terrain changes are added to the queues by the callback for the terrain change notifications.

DtNavAreasLocalExtents DtVrfNavAreaManager::myNavAreasLocalExtents
protected

Map of the the nav areas extents - converted to local coordinates. It is used within the terain chages processing.

bool DtVrfNavAreaManager::myRegisteredForTerrainChanges
protected

Indicates if the DtVrfNavAreaManager has a terrain notifications callback registered with the DtVantageTerrainEngine. The instance of the DtVantageTerrainEngine gets deleted when a the terrain/scenario is unloaded - the callback is lost. A new instance of the DtVantageTerrainEngine gets created when a new terrain/scenario is loaded - a new callback has to be registered.

bool DtVrfNavAreaManager::myNavigationInitialized
protected
DtSimulationServices* DtVrfNavAreaManager::mySimulationServices
protected
Coordinate_System* DtVrfNavAreaManager::myObjectCoordSys
protected

Coord system used for nav datas on embarked objects.

bool DtVrfNavAreaManager::myBlockingNavLoad
protected
DtNavArea::NavAreaId DtVrfNavAreaManager::myNextNavAreaId
protected
DtNavGenerationThreadCounter* DtVrfNavAreaManager::myNavGenThreadCounter
NavAreaAboutToBeRemovedList DtVrfNavAreaManager::myNavAreaAboutToRemRemovedList
mutableprotected
tbb::spin_mutex DtVrfNavAreaManager::myNavAreaExtentsMutex
protected
tbb::spin_rw_mutex DtVrfNavAreaManager::myNavAreaMutex
mutableprotected
tbb::spin_rw_mutex DtVrfNavAreaManager::myObjectNavAreaMutex
mutableprotected
DtVrfCallbackQueue* DtVrfNavAreaManager::myNavQueryProcessingParallelQueue
protected
std::atomic<bool> DtVrfNavAreaManager::myContinueProcessing
protected
std::atomic<bool> DtVrfNavAreaManager::myProcessingStopped
protected
tbb::task_arena DtVrfNavAreaManager::myNavAreaArena
protected
tbb::task_group DtVrfNavAreaManager::myNavAreaTaskGroup
protected
boost::signals2::connection DtVrfNavAreaManager::myUnloadTerrainConnection
protected
bool DtVrfNavAreaManager::myRegenInTempDirectory
protected
bool DtVrfNavAreaManager::myNavRegenerating = false
protected
bool DtVrfNavAreaManager::myNavOperations = false
protected

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

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)