17 #include <matrix/vlVector.h>
19 #include "boost/shared_ptr.hpp"
20 #include "boost/weak_ptr.hpp"
23 #include <tbb/spin_mutex.h>
60 typedef boost::shared_ptr<DtNavAreaQuery>
Ptr;
61 typedef boost::weak_ptr<DtNavAreaQuery>
WeakPtr;
70 virtual bool tick() = 0;
73 virtual bool success() = 0;
76 virtual bool navDataChanged() = 0;
79 virtual bool outOfWorkingMemory() = 0;
82 virtual bool hadComputationError() = 0;
85 virtual std::vector<DtVector> results() = 0;
91 virtual std::vector<DtVector>
debugPoints() {
return std::vector<DtVector>(); };
94 virtual void* internalQuery() = 0;
105 virtual bool tick() {
return true; };
111 virtual std::vector<DtVector>
results() {
return std::vector<DtVector>(); };
119 maxRegenerationThreads(2), regenerationDelay(2.5), queryTimeBudget(1),
120 regenerationFileDirectory() {};
124 int workingMemorySize;
235 typedef void (*DtSearchAreaPointCostModifierEvaluatorFcn)(
const DtVector& localPoint,
float* currentCost,
void* userData);
237 typedef void(*DtSectorRegenerationCb)(
void* userData);
243 static void setNavAreaCreatorFcn(DtNavAreaCreatorFcn fcn);
248 static bool navAreaDebuggingEnabled();
249 static void setNavAreaDebuggingEnabled(
bool enable);
256 bool parallelQueryQueueProcessing =
false,
257 std::vector<DtString> profiles = std::vector<DtString>()) = 0;
260 virtual NavAreaId navAreaId()
const = 0;
263 virtual void update(
float deltaTimeInSeconds) = 0;
267 virtual void processQueues() = 0;
270 virtual bool hasPendingQueries()
const = 0;
278 virtual bool inNavArea(
const DtVector& localPos)
const = 0;
285 virtual bool validPosition(
const DtString& profile,
const DtVector& localPos,
291 virtual bool navTopoPosition(
const DtVector& localPosition,
296 virtual bool localPosition(
const DtVector& navPosition,
301 virtual bool navTopoVector(
const DtVector& localVector,
306 virtual bool localVector(
const DtVector& navPosition,
310 virtual bool validForProfile(
const DtString& profile)
const = 0;
314 virtual bool profileEntitySize(
const DtString& profile,
double& radius,
double& height)
const = 0;
316 virtual DtNavDataDebugInfo* debugInfo() = 0;
318 virtual void setExtent(
DtExtent* e) = 0;
323 virtual double areaWidth()
const = 0;
324 virtual double areaLength()
const = 0;
335 DtPointOfInterestEvaluatorFcn evalFcn = 0, DtPathCalculatedEvaluatorFcn pathFcn = 0,
336 void* evalFcnUserData = 0) = 0;
344 double propagationRadius = 200., DtPointOfInterestNavTagEvaluatorFcn evalFcn = 0,
345 DtPathCalculatedEvaluatorFcn pathFcn = 0,
void* evalFcnUserData = 0) = 0;
350 virtual void findNearbyNavEdgesUsingNavTags(
const DtString& profile,
double searchRadius,
351 const DtVector& fromFromHere,
const std::vector<DtInputNavTag>& navTagVals,
352 std::list<const DtNavEdge*>& result)
const = 0;
356 virtual void findVerticesUsingNavTags(
const DtString& profile,
double searchRadius,
357 const DtVector& fromFromHere,
const std::vector<DtInputNavTag>& navTagVals,
358 std::list<DtVector>& result)
const = 0;
365 double propagationRadius = 200., DtPointOfInterestEvaluatorFcn evalFcn = 0,
366 DtPathCalculatedEvaluatorFcn pathFcn = 0,
void* evalFcnUserData = 0) = 0;
369 virtual bool isPositionInside(
const DtString& profile,
const DtVector& testPosition,
double searchHeight = 1000.)
const = 0;
374 virtual bool movePositionInsideIfOutside(
const DtString& profile,
375 double searchRadius,
double searchHeight,
376 const DtVector& fromFromHere,
DtVector& result,
int& halfEdgeType)
const = 0;
380 virtual bool findInsidePositionFromOutsidePosition(
const DtString& profile,
381 double searchRadius,
double searchHeight,
const DtVector& fromFromHere,
382 DtVector& result,
int& halfEdgeType)
const = 0;
386 const std::vector<DtVector>& localDestinationPositions,
DtNavBot* searcher,
int tag = -1,
387 DtSearchAreaPointCostModifierEvaluatorFcn = 0, DtPointOfInterestEvaluatorFcn = 0,
388 DtPathCalculatedEvaluatorFcn = 0,
void* usrData = 0,
bool startMovingWhenFound =
false) = 0;
392 const DtVector& destination,
bool useAbstractGraphs =
true,
398 virtual bool findFarthestPositionAlongHeading(
const DtString& profile,
const DtVector& start,
399 double heading,
double maxDistance,
DtVector& result,
bool& reachedMaxDist)
const = 0;
403 virtual bool doesNavIntersectBetweenTwoPoints(
const DtString& profile,
const DtVector& start,
437 const DtVector& localAccessibilityPoint = DtVector::zero(),
438 double minRadius = -1,
439 double maxRadius = -1,
441 unsigned numberOfPoints = 1,
442 double minDistanceBetweenPoints = 0.0,
443 const DtString& placementRestriction = DtString::nullString(),
444 bool isStrict =
true,
445 bool tightlyPack =
false,
446 bool needLos =
false,
447 bool groundClamp =
false,
449 DtLocalPointUserEvalCallback callbackFcn = emptyCallback,
450 void* userData = 0) = 0;
453 virtual bool tagVolumesToBeIntegrated()
const = 0;
469 virtual std::vector<DtVector> searchInArea(
const DtString& profile,
470 const DtVector& startLocalPos,
double radius,
double postSpacing,
DtNavBot* searcher,
471 DtPointOfInterestEvaluatorFcn evalFcn = 0,
void* evalFcnUserData = 0,
int tag = -1)
const = 0;
474 virtual bool navTrianglesInArea(
const DtString& profile,
const DtVector& location,
double radius,
475 std::list<DtNavTriangleInfo>& triangles) = 0;
478 virtual unsigned newNavTagId() = 0;
481 virtual void associateNavTagIdWithObject(
unsigned tagVolumeId,
const DtUUID& objectUUID) = 0;
484 virtual void disassociateNavTagId(
unsigned navTagId) = 0;
488 virtual DtUUID uuidFromNavTagId(
unsigned navTagId)
const = 0;
492 virtual unsigned navTagVolumeIdFromUuid(
const DtUUID& objectUUID) = 0;
502 virtual void addSectorRegenerationCallback(DtSectorRegenerationCb cb,
void* usr) = 0;
503 virtual void removeSectorRegenerationCallback(DtSectorRegenerationCb cb,
void* usr) = 0;
509 const std::set<DtString>& profiles = std::set<DtString>()) = 0;
515 virtual void pauseNavDataRegeneration() = 0;
518 virtual void resumeNavDataRegeneration() = 0;
521 virtual bool revertNavData() = 0;
526 virtual unsigned addNavEdge(
const DtString& profile, std::vector<DtVector>& LocalPoints,
532 virtual unsigned addNavIEdge(
const DtString& profile, std::vector<DtVector>& LocalPoints, std::vector< std::vector<DtVector> >& localIPoints,
536 virtual void removeNavEdge(
unsigned edgeId) = 0;
541 virtual unsigned addCoverPoint(
const DtString& profile,
const DtVector& localPoint,
542 bool& creationComplete) = 0;
545 virtual bool isCoverPointCreated(
unsigned coverPointId) = 0;
548 virtual void removeCoverPoint(
unsigned coverPointId) = 0;
551 virtual unsigned numberOfPendingQueries()
const = 0;
554 virtual bool objectNavData()
const = 0;
559 virtual void printNavDataInfoForLocation(
const DtVector& location, std::ostream& strm)
const = 0;
UUID is a unique ID wrapper class.
Definition: uuid.h:59
This class is just used to count the nav generation threads to ensure we do not start too many thread...
Definition: navArea.h:161
Test class for providing a fast way for an entity to "walk" along the nav mesh. This is the abstract ...
Definition: persistentPointAlongHeadingQuery.h:11
DtNavAreaQuery()
Definition: navArea.h:63
DtNavTagExt navTagExt
Definition: navArea.h:229
bool regenerateAtRuntime
Whether nav data should be regenerated at runtime.
Definition: navArea.h:130
DtNavGenerationThreadCounter(unsigned maxThreads)
Definition: navArea.h:164
DtOnPathToGraphVertexComputedResult
Definition: navArea.h:43
virtual ~DtNavAreaQuery()
Definition: navArea.h:64
Definition: navArea.h:225
void releaseAllThreads()
Definition: navArea.h:191
virtual bool tick()
Main function for performing query processing.
Definition: navArea.h:105
virtual bool outOfWorkingMemory()
Returns true if the query failed due to a lack of working memory.
Definition: navArea.h:109
double queryTimeBudget
The time budget per frame for path queries in ms. Default value is 1.
Definition: navArea.h:127
virtual bool success()
Returns true if the query completed successfully.
Definition: navArea.h:106
DtNavAreaNullQuery()
Definition: navArea.h:101
virtual ~DtNavArea()
Definition: navArea.h:252
Query that can be used when there is no valid navData.
Definition: navArea.h:98
double regenerationDelay
Minimum delay between an event resulting in nav data regeneration and the start of the regeneration t...
Definition: navArea.h:137
const int DtNavDataTagAny
Tag for a nav vertex that indicates a transition point out of a nav area. The nav tag size will be 1 ...
Definition: navDataTag.h:23
Contains the DtUUID class declaration.
The DtExtent represents an axis-aligned 3d bounding box.
Definition: extent.h:43
std::set< DtNavSectorName > DtNavSectorNames
Definition: navArea.h:51
virtual void cancel()
Definition: navArea.h:107
VR-Forces wrapper for Gameware NavTag. Note: This class keeps only a pointer to the data...
Definition: navDataTag.h:87
DtFilename regenerationFileDirectory
The directory in which nav data regeneration files should be stored.
Definition: navArea.h:140
const DtSimObject * attachedObject()
If this Nav Area is attached to a sim object, returns that object.
Definition: navArea.h:456
static bool theNavAreaDebuggingEnabled
Definition: navArea.h:564
static DtNavAreaCreatorFcn theNavAreaCreatorFcn
Definition: navArea.h:562
Definition: asyncJobServer.h:37
void releaseThread()
Definition: navArea.h:183
static const DtUUID & nullUUID()
unsigned NavAreaId
Definition: navArea.h:217
void setAttachedObject(const DtSimObject *object)
Sets the sim object his Nav Ara is attached to.
Definition: navArea.h:459
DtOnGraphVertexVisitedResult
Definition: navArea.h:34
Definition: coordSystem.h:54
virtual void * internalQuery(void)
A pointer to the internal query. Not generally used.
Definition: navArea.h:112
virtual ~DtNavRegenRequestIdData()
Definition: navArea.h:148
This class contains all the data and logic for navigation within a specific area. Nav Data may be loa...
Definition: navArea.h:206
std::list< const DtRwVariableBindings * > DtVariableBindingsList
Definition: readerWriterRegistry.h:29
Contains all the data and logic for navigation within a specific edge.
Definition: navEdge.h:18
virtual ~DtNavAreaNullQuery()
Definition: navArea.h:102
int port
Definition: navArea.h:212
This is just an abstract base class for the data contained in a DtNavRegenRequestId. The implementation of such an id is handled in a subclass.
Definition: navArea.h:145
bool(* DtNavBotPathLocationEvalFcn)(const DtNavTag &navTag, float slope, float elevationChange, float *costMultiplier, void *userData)
Definition: navBot.h:129
DtNavRegenRequestIdData(const DtNavRegenRequestIdData &)
Definition: navArea.h:152
DtTerrainInterface allows access to common terrain calls without having to know the terrain implement...
Definition: terrainInterface.h:100
boost::shared_ptr< DtNavAreaQuery > Ptr
Definition: navArea.h:60
virtual std::vector< DtVector > debugPoints()
A list of locations that may be generated to debug issues. May not relevant to all queries...
Definition: navArea.h:91
int maxRegenerationThreads
Maximum number of threads performing nav data regeneration at a time.
Definition: navArea.h:133
DtNavRegenRequestIdData()
Definition: navArea.h:151
const DtSimObject * myAttachedObject
Points to the host object if this navArea is attached to an object like a cultural feature or a large...
Definition: navArea.h:568
static const DtVariableBindingsList & nullVariableReference()
bool claimThread()
Definition: navArea.h:173
void setMaxThreads(unsigned maxThreads)
Definition: navArea.h:166
Class providing querying for entities in an extent within the nav mesh. This is the abstract base cla...
Definition: objectsCollectorInExtentQuery.h:11
Represents a single simulation object in the exercise. Object may be VRF simulation, or non-VRF simulated, and may be simulated by the local sim engine, or by a remote sim engine. Only public (external) state of the object is available. All data is read-only. All access to data of the object is thread safe within the simulation frame.
Definition: simObject.h:88
unsigned myUsedThreads
Definition: navArea.h:199
Definition: navArea.h:209
virtual bool navDataChanged()
Returns true if the nav data has changed during this query.
Definition: navArea.h:108
DtNavAreaConfig()
Definition: navArea.h:118
#define DT_DLL_vrfNavigation
This file is used to determine how to build.
Definition: vrfNavigationDefines.h:26
Configuration options for DtNavArea.
Definition: navArea.h:116
DtString status
Definition: navArea.h:214
virtual double outputValue()
An output value that may be the result of this query. May not relevant to all queries.
Definition: navArea.h:88
DtNavTag navTag
Definition: navArea.h:222
Extended DtNavTag class that keeps a local copy of myData.
Definition: navDataTag.h:110
boost::weak_ptr< DtNavRegenRequestIdData > DtNavRegenRequestId
Id used as a handle for nav regen requests. This is just an abstract base class.
Definition: navArea.h:157
virtual bool hadComputationError()
Returns true if the query failed due to a computation error.
Definition: navArea.h:110
class DtLocalVertexList:
Definition: localVertexList.h:20
DtString navAreaName
Definition: navArea.h:211
std::vector< DtRwString > profiles
Definition: navArea.h:213
Definition: navArea.h:218
virtual std::vector< DtVector > results()
A list of locations that may be the result of this query.
Definition: navArea.h:111
boost::weak_ptr< DtNavAreaQuery > WeakPtr
Definition: navArea.h:61
virtual bool complete()
Returns true when the query has completed.
Definition: navArea.h:104
Base class for all asynchronous Nav Area queries. In this context asynchronous means non-blocking...
Definition: navArea.h:57
unsigned myMaxThreads
Definition: navArea.h:198
unsigned maxThreads() const
Definition: navArea.h:171