Drag[en]gine Game Engine  1.21
deNavigator Class Reference

Navigate navigation spaces. More...

#include <deNavigator.h>

Inheritance diagram for deNavigator:
deResource deObject

Public Types

typedef deTObjectReference< deNavigatorRef
 Type holding strong reference. More...
 
- Public Types inherited from deResource
typedef deTObjectReference< deResourceRef
 Type holding strong reference. More...
 
- Public Types inherited from deObject
typedef deTObjectReference< deObjectRef
 Type holding strong reference. More...
 

Public Member Functions

Management
int GetLayer () const
 Layer number. More...
 
void SetLayer (int layer)
 Set layer number. More...
 
deNavigationSpace::eSpaceTypes GetSpaceType () const
 Space type to navigate. More...
 
void SetSpaceType (deNavigationSpace::eSpaceTypes spaceType)
 Set space type to navigate. More...
 
float GetMaxOutsideDistance () const
 Maximum distance the start and goal point are allowed to be outside any navigation space. More...
 
void SetMaxOutsideDistance (float maxDistance)
 Set maximum distance the start and goal point are allowed to be outside any navigation space. More...
 
float GetDefaultFixCost () const
 Fix cost to use if no matching type is found. More...
 
void SetDefaultFixCost (float cost)
 Set fix cost to use if no matching type is found. More...
 
float GetDefaultCostPerMeter () const
 Cost per meter to use if no matching type is found. More...
 
void SetDefaultCostPerMeter (float costPerMeter)
 Set cost per meter to use if no matching type is found. More...
 
float GetBlockingCost () const
 Maximum cost beyond which a node or path is considered impassable. More...
 
void SetBlockingCost (float cost)
 Set maximum cost beyond which a node or path is considered impassable. More...
 
int GetTypeCount () const
 Number of types. More...
 
deNavigatorTypeGetTypeAt (int index) const
 Type by index. More...
 
deNavigatorTypeGetTypeWith (int typeValue) const
 Matching type or NULL if not found. More...
 
int IndexOfType (deNavigatorType *type) const
 Index of a type or -1 if not found. More...
 
int IndexOfTypeWith (int typeValue) const
 Index of the type with the given type value or -1 if not found. More...
 
bool HasType (deNavigatorType *type) const
 Type exists. More...
 
bool HasTypeWith (int typeValue) const
 Type with the given type value exists. More...
 
deNavigatorTypeAddType (int type)
 Add type if not existing returning the type. More...
 
void RemoveType (deNavigatorType *type)
 Remove type. More...
 
void RemoveTypeWith (int typeValue)
 Remove type if existing. More...
 
void RemoveAllTypes ()
 Remove all types. More...
 
void NotifyTypesChanged ()
 Notify peers types changed. More...
 
void FindPath (deNavigatorPath &path, const decDVector &start, const decDVector &goal)
 Find path. More...
 
Testing
bool NearestPoint (const decDVector &point, float radius, decDVector &nearestPoint, int &nearestType) const
 Nearest point on nearest navigation space. More...
 
bool LineCollide (const decDVector &origin, const decVector &direction, float &distance) const
 Distance moving from point along direction before crossing navigation space boundaries. More...
 
Path Collision
bool PathCollideRay (const deNavigatorPath &path, deCollider &collider, int &hitAfterPoint, float &hitDistance) const
 Test path for collision using ray test. More...
 
bool PathCollideRay (const deNavigatorPath &path, deCollider &collider, const decDVector &startPosition, int nextPoint, float maxDistance, int &hitAfterPoint, float &hitDistance) const
 Test path for collision using ray test inside range. More...
 
bool PathCollideShape (const deNavigatorPath &path, deCollider &collider, deCollider &agent, int &hitAfterPoint, float &hitDistance) const
 Test path for collision using a collider moved along the path. More...
 
bool PathCollideShape (const deNavigatorPath &path, deCollider &collider, deCollider &agent, const decDVector &startPosition, int nextPoint, float maxDistance, int &hitAfterPoint, float &hitDistance) const
 Test path for collision using a collider moved along the path inside range. More...
 
System Peers
deBaseAINavigatorGetPeerAI () const
 AI system peer. More...
 
void SetPeerAI (deBaseAINavigator *peer)
 Set AI system peer. More...
 
Linked List
deWorldGetParentWorld () const
 Parent world or NULL. More...
 
void SetParentWorld (deWorld *world)
 Set parent world or NULL. More...
 
deNavigatorGetLLWorldPrev () const
 Previous navigator in the parent world linked list. More...
 
void SetLLWorldPrev (deNavigator *navigator)
 Set next navigator in the parent world linked list. More...
 
deNavigatorGetLLWorldNext () const
 Next navigator in the parent world linked list. More...
 
void SetLLWorldNext (deNavigator *navigator)
 Set next navigator in the parent world linked list. More...
 
- Public Member Functions inherited from deResource
deResourceManagerGetResourceManager () const
 Resource manager or NULL if resource is leaking. More...
 
deEngineGetEngine () const
 Game engine object from resource manager. More...
 
deResourceGetLLManagerPrev () const
 Previous resource in the resource manager linked list. More...
 
void SetLLManagerPrev (deResource *resource)
 Set next resource in the resource manager linked list. More...
 
deResourceGetLLManagerNext () const
 Next resource in the resource manager linked list. More...
 
void SetLLManagerNext (deResource *resource)
 Set next resource in the resource manager linked list. More...
 
void MarkLeaking ()
 Marks the resource leaking. More...
 
 deResource (deResourceManager *resourceManager)
 Create resource. More...
 
- Public Member Functions inherited from deObject
int GetRefCount () const
 Reference count. More...
 
void AddReference ()
 Add reference increasing reference count by 1. More...
 
void FreeReference ()
 Decrease reference count by one and delete object if count reaches 0. More...
 
 deObject ()
 Create object with reference count of 1. More...
 

Constructors and Destructors

 deNavigator (deNavigatorManager *manager)
 Create navigator. More...
 
virtual ~deNavigator ()
 Clean up navigator. More...
 

Additional Inherited Members

- Protected Member Functions inherited from deResource
virtual ~deResource ()
 Clean up resource. More...
 
- Protected Member Functions inherited from deObject
virtual ~deObject ()
 Clean up object. More...
 

Detailed Description

Navigate navigation spaces.

Blocking cost defines the maximum cost above which a node or conneciton is considered impassable. By default this is set to 1'000'000. Hence using a fix cost of more than 1M marks the node or connection as blocked or impassable.

Member Typedef Documentation

◆ Ref

Type holding strong reference.

Constructor & Destructor Documentation

◆ deNavigator()

deNavigator::deNavigator ( deNavigatorManager manager)

Create navigator.

◆ ~deNavigator()

virtual deNavigator::~deNavigator ( )
protectedvirtual

Clean up navigator.

Note
Subclasses should set their destructor protected too to avoid users accidently deleting a reference counted object through the object pointer. Only FreeReference() is allowed to delete the object.

Member Function Documentation

◆ AddType()

deNavigatorType* deNavigator::AddType ( int  type)

Add type if not existing returning the type.

◆ FindPath()

void deNavigator::FindPath ( deNavigatorPath path,
const decDVector start,
const decDVector goal 
)

Find path.

Replaces path with found path. If path can not be found the path is empty.

Parameters
[out]pathPath to update.
[in]startStart position of path.
[in]goalGoal position of path.

◆ GetBlockingCost()

float deNavigator::GetBlockingCost ( ) const
inline

Maximum cost beyond which a node or path is considered impassable.

◆ GetDefaultCostPerMeter()

float deNavigator::GetDefaultCostPerMeter ( ) const
inline

Cost per meter to use if no matching type is found.

◆ GetDefaultFixCost()

float deNavigator::GetDefaultFixCost ( ) const
inline

Fix cost to use if no matching type is found.

◆ GetLayer()

int deNavigator::GetLayer ( ) const
inline

Layer number.

◆ GetLLWorldNext()

deNavigator* deNavigator::GetLLWorldNext ( ) const
inline

Next navigator in the parent world linked list.

◆ GetLLWorldPrev()

deNavigator* deNavigator::GetLLWorldPrev ( ) const
inline

Previous navigator in the parent world linked list.

◆ GetMaxOutsideDistance()

float deNavigator::GetMaxOutsideDistance ( ) const
inline

Maximum distance the start and goal point are allowed to be outside any navigation space.

If the start or goal point is outside the range path update returns an empty path. The default disstance is 0.5m .

◆ GetParentWorld()

deWorld* deNavigator::GetParentWorld ( ) const
inline

Parent world or NULL.

◆ GetPeerAI()

deBaseAINavigator* deNavigator::GetPeerAI ( ) const
inline

AI system peer.

◆ GetSpaceType()

deNavigationSpace::eSpaceTypes deNavigator::GetSpaceType ( ) const
inline

Space type to navigate.

◆ GetTypeAt()

deNavigatorType* deNavigator::GetTypeAt ( int  index) const

Type by index.

◆ GetTypeCount()

int deNavigator::GetTypeCount ( ) const
inline

Number of types.

◆ GetTypeWith()

deNavigatorType* deNavigator::GetTypeWith ( int  typeValue) const

Matching type or NULL if not found.

◆ HasType()

bool deNavigator::HasType ( deNavigatorType type) const

Type exists.

◆ HasTypeWith()

bool deNavigator::HasTypeWith ( int  typeValue) const

Type with the given type value exists.

◆ IndexOfType()

int deNavigator::IndexOfType ( deNavigatorType type) const

Index of a type or -1 if not found.

◆ IndexOfTypeWith()

int deNavigator::IndexOfTypeWith ( int  typeValue) const

Index of the type with the given type value or -1 if not found.

◆ LineCollide()

bool deNavigator::LineCollide ( const decDVector origin,
const decVector direction,
float &  distance 
) const

Distance moving from point along direction before crossing navigation space boundaries.

Parameters
[in]originOrigin to start moving. Use NearestPoint() to make sure it is located on a navigation space.
[in]directionDirection to move starting at origin.
[out]distanceSet to the distance along displacement as percentage from 0 to 1 before touching a navigation space boundary. Set to 1 if no border is touched.
Return values
trueorigin is located in the navigation space and moving along direction a navigation space boundary is touched. distance is set to the travelled percentage of direction.
falseorigin is not located in the navigation space.
falseNo navigation space boundary is hit moving along line.

◆ NearestPoint()

bool deNavigator::NearestPoint ( const decDVector point,
float  radius,
decDVector nearestPoint,
int &  nearestType 
) const

Nearest point on nearest navigation space.

Default implementation returns false. AI module has to subclass this method.

Parameters
[in]pointPoint to find nearest point for.
[in]radiusMaximum radius clamped to 0 or larger to find nearest point in.
[out]nearestPointSet to the nearest point if found.
[out]nearestTypeSet to the type number of the nearest point if found.
Return values
trueNearest point is found and written to nearestPoint and nearestType.
falseNo nearest point found inside radius around point.
falseThere are no matching navigation spaces.

◆ NotifyTypesChanged()

void deNavigator::NotifyTypesChanged ( )

Notify peers types changed.

◆ PathCollideRay() [1/2]

bool deNavigator::PathCollideRay ( const deNavigatorPath path,
deCollider collider,
const decDVector startPosition,
int  nextPoint,
float  maxDistance,
int &  hitAfterPoint,
float &  hitDistance 
) const

Test path for collision using ray test inside range.

Parameters
[in]pathPath to use for testing.
[in]startPositionStarting position for testing.
[in]nextPointIndex of next point along the path to test. If this is equal to GetPathPointCount() the goal position is used.
[in]maxDistanceLimit testing to maxDistance meters after startPosition along path.
[out]hitAfterPointIndex of point after which the collision has been found.
[out]hitDistanceRelative distance from 0 to 1 along segment after hitAfterPoint.
Exceptions
EOutOfBoundarynextPoint is less than 0 or larger than GetPathPointCount().
Return values
trueif a collision is found and hitAfterPoint and hitDistance are set.
falseNo collision found.

◆ PathCollideRay() [2/2]

bool deNavigator::PathCollideRay ( const deNavigatorPath path,
deCollider collider,
int &  hitAfterPoint,
float &  hitDistance 
) const

Test path for collision using ray test.

Parameters
[in]pathPath to use for testing.
[out]hitAfterPointIndex of point after which the collision has been found.
[out]hitDistanceRelative distance from 0 to 1 along segment after hitAfterPoint.
Return values
trueif a collision is found and hitAfterPoint and hitDistance are set.
falseNo collision found.

◆ PathCollideShape() [1/2]

bool deNavigator::PathCollideShape ( const deNavigatorPath path,
deCollider collider,
deCollider agent,
const decDVector startPosition,
int  nextPoint,
float  maxDistance,
int &  hitAfterPoint,
float &  hitDistance 
) const

Test path for collision using a collider moved along the path inside range.

Parameters
[in]pathPath to use for testing.
[in]startPositionStarting position for testing.
[in]nextPointIndex of next point along the path to test. If this is equal to GetPathPointCount() the goal position is used.
[in]maxDistanceLimit testing to maxDistance meters after startPosition along path.
[out]hitAfterPointIndex of point after which the collision has been found.
[out]hitDistanceRelative distance from 0 to 1 along segment after hitAfterPoint.
Exceptions
EOutOfBoundarynextPoint is less than 0 or larger than GetPathPointCount().
Return values
trueif a collision is found and hitAfterPoint and hitDistance are set.
falseNo collision found.

◆ PathCollideShape() [2/2]

bool deNavigator::PathCollideShape ( const deNavigatorPath path,
deCollider collider,
deCollider agent,
int &  hitAfterPoint,
float &  hitDistance 
) const

Test path for collision using a collider moved along the path.

Parameters
[in]pathPath to use for testing.
[out]hitAfterPointIndex of point after which the collision has been found.
[out]hitDistanceRelative distance from 0 to 1 along segment after hitAfterPoint.
Return values
trueif a collision is found and hitAfterPoint and hitDistance are set.
falseNo collision found.

◆ RemoveAllTypes()

void deNavigator::RemoveAllTypes ( )

Remove all types.

◆ RemoveType()

void deNavigator::RemoveType ( deNavigatorType type)

Remove type.

◆ RemoveTypeWith()

void deNavigator::RemoveTypeWith ( int  typeValue)

Remove type if existing.

◆ SetBlockingCost()

void deNavigator::SetBlockingCost ( float  cost)

Set maximum cost beyond which a node or path is considered impassable.

◆ SetDefaultCostPerMeter()

void deNavigator::SetDefaultCostPerMeter ( float  costPerMeter)

Set cost per meter to use if no matching type is found.

◆ SetDefaultFixCost()

void deNavigator::SetDefaultFixCost ( float  cost)

Set fix cost to use if no matching type is found.

◆ SetLayer()

void deNavigator::SetLayer ( int  layer)

Set layer number.

◆ SetLLWorldNext()

void deNavigator::SetLLWorldNext ( deNavigator navigator)

Set next navigator in the parent world linked list.

◆ SetLLWorldPrev()

void deNavigator::SetLLWorldPrev ( deNavigator navigator)

Set next navigator in the parent world linked list.

◆ SetMaxOutsideDistance()

void deNavigator::SetMaxOutsideDistance ( float  maxDistance)

Set maximum distance the start and goal point are allowed to be outside any navigation space.

If the start or goal point is outside the range path update returns an empty path.

◆ SetParentWorld()

void deNavigator::SetParentWorld ( deWorld world)

Set parent world or NULL.

◆ SetPeerAI()

void deNavigator::SetPeerAI ( deBaseAINavigator peer)

Set AI system peer.

◆ SetSpaceType()

void deNavigator::SetSpaceType ( deNavigationSpace::eSpaceTypes  spaceType)

Set space type to navigate.


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