Drag[en]gine Game Engine  1.0
deNavigator Class Reference

Navigate navigation spaces. More...

#include <deNavigator.h>

Inheritance diagram for deNavigator:
deResource deObject

Public Member Functions

Management
const decDVectorGetStartPosition () const
 Start position. More...
 
void SetStartPosition (const decDVector &position)
 Set start position. More...
 
const decDVectorGetGoalPosition () const
 Goal position. More...
 
void SetGoalPosition (const decDVector &position)
 Set goal position. More...
 
int GetLayer () const
 Layer number. More...
 
void SetLayer (int layer)
 Set layer number. More...
 
int GetSpaceType () const
 Space type to navigate. More...
 
void SetSpaceType (int 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 UpdatePath ()
 Update path. More...
 
Path Points
int GetPathPointCount () const
 Number of path points. More...
 
const decDVectorGetPathPointAt (int index) const
 Path point at index. More...
 
void SetPathPointAt (int index, const decDVector &position)
 Set path point at index. More...
 
void AddPathPoint (const decDVector &point)
 Add path point. More...
 
void RemovePathPoint (int index)
 Remove path point at index. More...
 
void RemoveAllPathPoints ()
 Remove all path points. More...
 
void NotifyPathChanged ()
 Path changed. 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 (deCollider &collider, int &hitAfterPoint, float &hitDistance) const
 Test path for collision using ray test. More...
 
bool PathCollideRay (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 (deCollider &collider, deCollider &agent, int &hitAfterPoint, float &hitDistance) const
 Test path for collision using a collider moved along the path. More...
 
bool PathCollideShape (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.

Author
Pl├╝ss Roland
Version
1.0
Date
2016

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

◆ AddPathPoint()

void deNavigator::AddPathPoint ( const decDVector point)

Add path point.

Referenced by GetPathPointCount().

◆ AddType()

deNavigatorType* deNavigator::AddType ( int  type)

Add type if not existing returning the type.

Referenced by GetTypeCount().

◆ GetBlockingCost()

float deNavigator::GetBlockingCost ( ) const
inline

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

References SetBlockingCost().

◆ GetDefaultCostPerMeter()

float deNavigator::GetDefaultCostPerMeter ( ) const
inline

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

References SetDefaultCostPerMeter().

◆ GetDefaultFixCost()

float deNavigator::GetDefaultFixCost ( ) const
inline

Fix cost to use if no matching type is found.

References SetDefaultFixCost().

◆ GetGoalPosition()

const decDVector& deNavigator::GetGoalPosition ( ) const
inline

Goal position.

References SetGoalPosition().

◆ GetLayer()

int deNavigator::GetLayer ( ) const
inline

Layer number.

References SetLayer().

◆ GetLLWorldNext()

deNavigator* deNavigator::GetLLWorldNext ( ) const
inline

Next navigator in the parent world linked list.

References SetLLWorldNext().

◆ GetLLWorldPrev()

deNavigator* deNavigator::GetLLWorldPrev ( ) const
inline

Previous navigator in the parent world linked list.

References SetLLWorldPrev().

◆ 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 .

References SetMaxOutsideDistance().

◆ GetParentWorld()

deWorld* deNavigator::GetParentWorld ( ) const
inline

Parent world or NULL.

References SetParentWorld().

◆ GetPathPointAt()

const decDVector& deNavigator::GetPathPointAt ( int  index) const

Path point at index.

Exceptions
deeOutOfBoundaryindex is less than 0 or greater than or equal to GetPathPointCount().

Referenced by GetPathPointCount().

◆ GetPathPointCount()

int deNavigator::GetPathPointCount ( ) const
inline

◆ GetPeerAI()

deBaseAINavigator* deNavigator::GetPeerAI ( ) const
inline

AI system peer.

References SetPeerAI().

◆ GetSpaceType()

int deNavigator::GetSpaceType ( ) const
inline

Space type to navigate.

References SetSpaceType().

◆ GetStartPosition()

const decDVector& deNavigator::GetStartPosition ( ) const
inline

Start position.

References SetStartPosition().

◆ GetTypeAt()

deNavigatorType* deNavigator::GetTypeAt ( int  index) const

Type by index.

Referenced by GetTypeCount().

◆ GetTypeCount()

◆ GetTypeWith()

deNavigatorType* deNavigator::GetTypeWith ( int  typeValue) const

Matching type or NULL if not found.

Referenced by GetTypeCount().

◆ HasType()

bool deNavigator::HasType ( deNavigatorType type) const

Type exists.

Referenced by GetTypeCount().

◆ HasTypeWith()

bool deNavigator::HasTypeWith ( int  typeValue) const

Type with the given type value exists.

Referenced by GetTypeCount().

◆ IndexOfType()

int deNavigator::IndexOfType ( deNavigatorType type) const

Index of a type or -1 if not found.

Referenced by GetTypeCount().

◆ IndexOfTypeWith()

int deNavigator::IndexOfTypeWith ( int  typeValue) const

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

Referenced by GetTypeCount().

◆ 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.

Referenced by GetPathPointCount().

◆ 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.

Referenced by GetPathPointCount().

◆ NotifyPathChanged()

void deNavigator::NotifyPathChanged ( )

Path changed.

Call after changing the path by the game scripts.

Referenced by GetPathPointCount().

◆ NotifyTypesChanged()

void deNavigator::NotifyTypesChanged ( )

Notify peers types changed.

Referenced by GetTypeCount().

◆ PathCollideRay() [1/2]

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

Test path for collision using ray test.

Parameters
[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.

Referenced by GetPathPointCount().

◆ PathCollideRay() [2/2]

bool deNavigator::PathCollideRay ( 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]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() [1/2]

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

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

Parameters
[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.

Referenced by GetPathPointCount().

◆ PathCollideShape() [2/2]

bool deNavigator::PathCollideShape ( 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]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.

◆ RemoveAllPathPoints()

void deNavigator::RemoveAllPathPoints ( )

Remove all path points.

Referenced by GetPathPointCount().

◆ RemoveAllTypes()

void deNavigator::RemoveAllTypes ( )

Remove all types.

Referenced by GetTypeCount().

◆ RemovePathPoint()

void deNavigator::RemovePathPoint ( int  index)

Remove path point at index.

Exceptions
deeOutOfBoundaryindex is less than 0 or greater than or equal to GetPathPointCount().

Referenced by GetPathPointCount().

◆ RemoveType()

void deNavigator::RemoveType ( deNavigatorType type)

Remove type.

Referenced by GetTypeCount().

◆ RemoveTypeWith()

void deNavigator::RemoveTypeWith ( int  typeValue)

Remove type if existing.

Referenced by GetTypeCount().

◆ SetBlockingCost()

void deNavigator::SetBlockingCost ( float  cost)

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

Referenced by GetBlockingCost().

◆ SetDefaultCostPerMeter()

void deNavigator::SetDefaultCostPerMeter ( float  costPerMeter)

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

Referenced by GetDefaultCostPerMeter().

◆ SetDefaultFixCost()

void deNavigator::SetDefaultFixCost ( float  cost)

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

Referenced by GetDefaultFixCost().

◆ SetGoalPosition()

void deNavigator::SetGoalPosition ( const decDVector position)

Set goal position.

Referenced by GetGoalPosition().

◆ SetLayer()

void deNavigator::SetLayer ( int  layer)

Set layer number.

Referenced by GetLayer().

◆ SetLLWorldNext()

void deNavigator::SetLLWorldNext ( deNavigator navigator)

Set next navigator in the parent world linked list.

Referenced by GetLLWorldNext().

◆ SetLLWorldPrev()

void deNavigator::SetLLWorldPrev ( deNavigator navigator)

Set next navigator in the parent world linked list.

Referenced by GetLLWorldPrev().

◆ 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.

Referenced by GetMaxOutsideDistance().

◆ SetParentWorld()

void deNavigator::SetParentWorld ( deWorld world)

Set parent world or NULL.

Referenced by GetParentWorld().

◆ SetPathPointAt()

void deNavigator::SetPathPointAt ( int  index,
const decDVector position 
)

Set path point at index.

Exceptions
deeOutOfBoundaryindex is less than 0 or greater than or equal to GetPathPointCount().

Referenced by GetPathPointCount().

◆ SetPeerAI()

void deNavigator::SetPeerAI ( deBaseAINavigator peer)

Set AI system peer.

Referenced by GetPeerAI().

◆ SetSpaceType()

void deNavigator::SetSpaceType ( int  spaceType)

Set space type to navigate.

Referenced by GetSpaceType().

◆ SetStartPosition()

void deNavigator::SetStartPosition ( const decDVector position)

Set start position.

Referenced by GetStartPosition().

◆ UpdatePath()

void deNavigator::UpdatePath ( )

Update path.

Referenced by GetTypeCount().


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