Drag[en]gine Game Engine
1.21
|
Navigate navigation spaces. More...
#include <deNavigator.h>
Public Types | |
typedef deTObjectReference< deNavigator > | Ref |
Type holding strong reference. More... | |
Public Types inherited from deResource | |
typedef deTObjectReference< deResource > | Ref |
Type holding strong reference. More... | |
Public Types inherited from deObject | |
typedef deTObjectReference< deObject > | Ref |
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... | |
deNavigatorType * | GetTypeAt (int index) const |
Type by index. More... | |
deNavigatorType * | GetTypeWith (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... | |
deNavigatorType * | AddType (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 | |
deBaseAINavigator * | GetPeerAI () const |
AI system peer. More... | |
void | SetPeerAI (deBaseAINavigator *peer) |
Set AI system peer. More... | |
Linked List | |
deWorld * | GetParentWorld () const |
Parent world or NULL. More... | |
void | SetParentWorld (deWorld *world) |
Set parent world or NULL. More... | |
deNavigator * | GetLLWorldPrev () const |
Previous navigator in the parent world linked list. More... | |
void | SetLLWorldPrev (deNavigator *navigator) |
Set next navigator in the parent world linked list. More... | |
deNavigator * | GetLLWorldNext () 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 | |
deResourceManager * | GetResourceManager () const |
Resource manager or NULL if resource is leaking. More... | |
deEngine * | GetEngine () const |
Game engine object from resource manager. More... | |
deResource * | GetLLManagerPrev () const |
Previous resource in the resource manager linked list. More... | |
void | SetLLManagerPrev (deResource *resource) |
Set next resource in the resource manager linked list. More... | |
deResource * | GetLLManagerNext () 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... | |
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.
Type holding strong reference.
deNavigator::deNavigator | ( | deNavigatorManager * | manager | ) |
Create navigator.
|
protectedvirtual |
Clean up navigator.
deNavigatorType* deNavigator::AddType | ( | int | type | ) |
Add type if not existing returning the type.
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.
[out] | path | Path to update. |
[in] | start | Start position of path. |
[in] | goal | Goal position of path. |
|
inline |
Maximum cost beyond which a node or path is considered impassable.
|
inline |
Cost per meter to use if no matching type is found.
|
inline |
Fix cost to use if no matching type is found.
|
inline |
Layer number.
|
inline |
Next navigator in the parent world linked list.
|
inline |
Previous navigator in the parent world linked list.
|
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 .
|
inline |
Parent world or NULL.
|
inline |
AI system peer.
|
inline |
Space type to navigate.
deNavigatorType* deNavigator::GetTypeAt | ( | int | index | ) | const |
Type by index.
|
inline |
Number of types.
deNavigatorType* deNavigator::GetTypeWith | ( | int | typeValue | ) | const |
Matching type or NULL if not found.
bool deNavigator::HasType | ( | deNavigatorType * | type | ) | const |
Type exists.
bool deNavigator::HasTypeWith | ( | int | typeValue | ) | const |
Type with the given type value exists.
int deNavigator::IndexOfType | ( | deNavigatorType * | type | ) | const |
Index of a type or -1 if not found.
int deNavigator::IndexOfTypeWith | ( | int | typeValue | ) | const |
Index of the type with the given type value or -1 if not found.
bool deNavigator::LineCollide | ( | const decDVector & | origin, |
const decVector & | direction, | ||
float & | distance | ||
) | const |
Distance moving from point along direction before crossing navigation space boundaries.
[in] | origin | Origin to start moving. Use NearestPoint() to make sure it is located on a navigation space. |
[in] | direction | Direction to move starting at origin. |
[out] | distance | Set 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. |
true | origin 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. |
false | origin is not located in the navigation space. |
false | No navigation space boundary is hit moving along line. |
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.
[in] | point | Point to find nearest point for. |
[in] | radius | Maximum radius clamped to 0 or larger to find nearest point in. |
[out] | nearestPoint | Set to the nearest point if found. |
[out] | nearestType | Set to the type number of the nearest point if found. |
true | Nearest point is found and written to nearestPoint and nearestType. |
false | No nearest point found inside radius around point. |
false | There are no matching navigation spaces. |
void deNavigator::NotifyTypesChanged | ( | ) |
Notify peers types changed.
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.
[in] | path | Path to use for testing. |
[in] | startPosition | Starting position for testing. |
[in] | nextPoint | Index of next point along the path to test. If this is equal to GetPathPointCount() the goal position is used. |
[in] | maxDistance | Limit testing to maxDistance meters after startPosition along path. |
[out] | hitAfterPoint | Index of point after which the collision has been found. |
[out] | hitDistance | Relative distance from 0 to 1 along segment after hitAfterPoint. |
EOutOfBoundary | nextPoint is less than 0 or larger than GetPathPointCount(). |
true | if a collision is found and hitAfterPoint and hitDistance are set. |
false | No collision found. |
bool deNavigator::PathCollideRay | ( | const deNavigatorPath & | path, |
deCollider & | collider, | ||
int & | hitAfterPoint, | ||
float & | hitDistance | ||
) | const |
Test path for collision using ray test.
[in] | path | Path to use for testing. |
[out] | hitAfterPoint | Index of point after which the collision has been found. |
[out] | hitDistance | Relative distance from 0 to 1 along segment after hitAfterPoint. |
true | if a collision is found and hitAfterPoint and hitDistance are set. |
false | No collision found. |
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.
[in] | path | Path to use for testing. |
[in] | startPosition | Starting position for testing. |
[in] | nextPoint | Index of next point along the path to test. If this is equal to GetPathPointCount() the goal position is used. |
[in] | maxDistance | Limit testing to maxDistance meters after startPosition along path. |
[out] | hitAfterPoint | Index of point after which the collision has been found. |
[out] | hitDistance | Relative distance from 0 to 1 along segment after hitAfterPoint. |
EOutOfBoundary | nextPoint is less than 0 or larger than GetPathPointCount(). |
true | if a collision is found and hitAfterPoint and hitDistance are set. |
false | No collision found. |
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.
[in] | path | Path to use for testing. |
[out] | hitAfterPoint | Index of point after which the collision has been found. |
[out] | hitDistance | Relative distance from 0 to 1 along segment after hitAfterPoint. |
true | if a collision is found and hitAfterPoint and hitDistance are set. |
false | No collision found. |
void deNavigator::RemoveAllTypes | ( | ) |
Remove all types.
void deNavigator::RemoveType | ( | deNavigatorType * | type | ) |
Remove type.
void deNavigator::RemoveTypeWith | ( | int | typeValue | ) |
Remove type if existing.
void deNavigator::SetBlockingCost | ( | float | cost | ) |
Set maximum cost beyond which a node or path is considered impassable.
void deNavigator::SetDefaultCostPerMeter | ( | float | costPerMeter | ) |
Set cost per meter to use if no matching type is found.
void deNavigator::SetDefaultFixCost | ( | float | cost | ) |
Set fix cost to use if no matching type is found.
void deNavigator::SetLayer | ( | int | layer | ) |
Set layer number.
void deNavigator::SetLLWorldNext | ( | deNavigator * | navigator | ) |
Set next navigator in the parent world linked list.
void deNavigator::SetLLWorldPrev | ( | deNavigator * | navigator | ) |
Set next navigator in the parent world linked list.
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.
void deNavigator::SetParentWorld | ( | deWorld * | world | ) |
Set parent world or NULL.
void deNavigator::SetPeerAI | ( | deBaseAINavigator * | peer | ) |
Set AI system peer.
void deNavigator::SetSpaceType | ( | deNavigationSpace::eSpaceTypes | spaceType | ) |
Set space type to navigate.