Drag[en]gine Game Engine  1.21
deNavigationSpace Class Reference

Navigation Space. Defines a space for AI navigation. A navigation space composes of a list of nodes and connections between them. Navigation spaces can be either grids, meshes or volumes. In addition each navigation space has a layer number. Navigation spaces with the same layer number are linked together. Using different layers different navigation spaces can be used side by side in the same world. This can be due to different requirements of game entities or to use spaces of varying resolution. The navigation grid is the default type for newly created navigation spaces. More...

#include <deNavigationSpace.h>

Inheritance diagram for deNavigationSpace:
deResource deObject

Public Types

enum  eSpaceTypes { estGrid , estMesh , estVolume }
 Space Type. More...
 
typedef deTObjectReference< deNavigationSpaceRef
 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
eSpaceTypes GetType () const
 Space type. More...
 
void SetType (eSpaceTypes type)
 Set space type. More...
 
int GetLayer () const
 Layer number. More...
 
void SetLayer (int layer)
 Set layer number. More...
 
const decDVectorGetPosition () const
 Position. More...
 
void SetPosition (const decDVector &position)
 Set position. More...
 
const decQuaternionGetOrientation () const
 Orientation. More...
 
void SetOrientation (const decQuaternion &orientation)
 Set orientation. More...
 
float GetSnapDistance () const
 Snap distance in meters up to which edges are linked to neighbor spaces. More...
 
void SetSnapDistance (float distance)
 Set snap distance in meters up to which edges are linked to neighbor spaces. More...
 
float GetSnapAngle () const
 Snap angle in radians up to which edges are linked to neighbor spaces. More...
 
void SetSnapAngle (float angle)
 Set snap angle in radians up to which edges are linked to neighbor spaces. More...
 
decShapeListGetBlockerShapeList ()
 Blocker shape list. More...
 
const decShapeListGetBlockerShapeList () const
 
void NotifyBlockerShapeListChanged ()
 Notifies the peers that the blocker shape list changed. More...
 
int GetBlockingPriority () const
 Blocking priority. More...
 
void SetBlockingPriority (int priority)
 Set blocking priority. More...
 
void NotifyLayoutChanged ()
 
bool Verify () const
 Verify the navigation space. More...
 
Vertices
int GetVertexCount () const
 Number of vertices. More...
 
void SetVertexCount (int count)
 Set number of vertices. More...
 
const decVectorGetVertexAt (int index) const
 Vertex at the given position. More...
 
void SetVertexAt (int index, const decVector &vertex)
 Set vertex at the given position. More...
 
decVectorGetVertices () const
 Pointer to the vertices. More...
 
Edges
int GetEdgeCount () const
 Number of edges. More...
 
void SetEdgeCount (int count)
 Set number of edges. More...
 
deNavigationSpaceEdgeGetEdgeAt (int index) const
 Edge at the given position. More...
 
deNavigationSpaceEdgeGetEdges () const
 Pointer to the edges. More...
 
Corners
int GetCornerCount () const
 Number of corners. More...
 
void SetCornerCount (int count)
 Set number of corners. More...
 
deNavigationSpaceCornerGetCornerAt (int index) const
 Corner at the given position. More...
 
deNavigationSpaceCornerGetCorners () const
 Pointer to the corners. More...
 
Faces
int GetFaceCount () const
 Number of faces. More...
 
void SetFaceCount (int count)
 Set number of faces. More...
 
deNavigationSpaceFaceGetFaceAt (int index) const
 Face at the given position. More...
 
deNavigationSpaceFaceGetFaces () const
 Pointer to the faces. More...
 
Walls
int GetWallCount () const
 Number of walls. More...
 
void SetWallCount (int count)
 Set number of walls. More...
 
deNavigationSpaceWallGetWallAt (int index) const
 Wall at the given position. More...
 
deNavigationSpaceWallGetWalls () const
 Pointer to the walls. More...
 
Rooms
int GetRoomCount () const
 Number of rooms. More...
 
void SetRoomCount (int count)
 Set number of rooms. More...
 
deNavigationSpaceRoomGetRoomAt (int index) const
 Room at the given position. More...
 
deNavigationSpaceRoomGetRooms () const
 Pointer to the rooms. More...
 
System Peers
deBaseAINavigationSpaceGetPeerAI () const
 AI system peer. More...
 
void SetPeerAI (deBaseAINavigationSpace *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...
 
deNavigationSpaceGetLLWorldPrev () const
 Previous navigation space in the parent world linked list. More...
 
void SetLLWorldPrev (deNavigationSpace *navspace)
 Set next navigation space in the parent world linked list. More...
 
deNavigationSpaceGetLLWorldNext () const
 Next navigation space in the parent world linked list. More...
 
void SetLLWorldNext (deNavigationSpace *navspace)
 Set next navigation space 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

 deNavigationSpace (deNavigationSpaceManager *manager)
 Create new navigation space with the given resource manager. More...
 
virtual ~deNavigationSpace ()
 Clean up animator. 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

Navigation Space. Defines a space for AI navigation. A navigation space composes of a list of nodes and connections between them. Navigation spaces can be either grids, meshes or volumes. In addition each navigation space has a layer number. Navigation spaces with the same layer number are linked together. Using different layers different navigation spaces can be used side by side in the same world. This can be due to different requirements of game entities or to use spaces of varying resolution. The navigation grid is the default type for newly created navigation spaces.

Navigation Grid
Navigation grids are useful for navigation problems where an exact and smooth path is not required. This is usually used for coarse grained navigation typically not directly linked to a visible world. In this navigation space vertices are the nodes and edges are the connections. Thus for a valid navigation grid vertices and edges have to be defined. The cost function is calculated using the type stored in the edges. The resulting cost function is thus:
cost = edge.fixCost + edge.costPerMeter * distance
Navigation Mesh
Navigation meshes are useful for all kinds of navigation problems in detailed scene geometry where a smooth path around the world is desired. This is the typical space used for AI navigation of visible game actors. Most of the time you want to use this type of navigation space. In this navigation space faces are the nodes and edges the connections. In contrary to the navigation grid the connection is located at the edges of the face. Thus for a valid navigation mesh vertices, corners and faces have to be defined. Here corners are the vertices used in the faces and are stored as a continuous array of vertex indices. Set the firstCorner and cornerCount in faces accordingly to assign the right set of vertex indices to each face. The orientation of faces does not matter. The cost function is calculated using the type stored in the faces as well as the edges. For the edges only the fix cost is used. This way certain edges can be penalized or even disallowed to be crossed. The resulting cost function is thus:
cost = edge.fixCost + face.fixCost + face.costPerMeter * distance
Navigation Volume
Navigation volumes are useful for all navigation problems that navigation meshes can not accurately represent anymore. These are typically situations where the movement of actors is not limited anymore to moving on the ground with jumping or hovering but where they can roam around three dimensions freely. A good example for this is Descent where the AI roams around in 0-gravity inside a large cavern complex. Here navigation volumes provide the same smooth path finding around the game world as does the navigation mesh just in three dimensions. In this navigation space rooms are the nodes and faces are the connections. Here too the Rooms are directly connected to each other using faces similar to navigation meshes. Thus for a valid navigation volume vertices, corners, faces, walls and rooms have to be defined. Here corners are the vertices used in faces as in the case of navigation meshes and walls are the indices of faces used in the rooms and are stored as a continuous array of face indices. Set the firstWall and wallCount in rooms accordingly to assign the right set of faces to each room. The orientation of faces does not matter. The cost function is calculated using the type stored in the rooms as well as the faces. For the faces only the fix cost is used. This way certain faces can be penalized or even disallowed to be crossed. The resulting cost function is thus:
cost = face.fixCost + room.fixCost + room.costPerMeter * distance
Blocker
Navigation spaces can contain a list of blocker shapes. The definition and behavior is similar to deNavigationBlocker but with the difference that the blocking applies only to all other navigation spaces except this one. This allows to use a navigation space to refine existing navigation spaces by blocking out certain space and snapping in the new navigation space. A good example is adding stairs to a room where the stairs blocks out all other navigation spaces and attaches itself to the emerging navigation space borders.

Member Typedef Documentation

◆ Ref

Type holding strong reference.

Member Enumeration Documentation

◆ eSpaceTypes

Space Type.

Enumerator
estGrid 

Navigation Grid.

estMesh 

Navigation Mesh.

estVolume 

Navigation Volume.

Constructor & Destructor Documentation

◆ deNavigationSpace()

deNavigationSpace::deNavigationSpace ( deNavigationSpaceManager manager)

Create new navigation space with the given resource manager.

◆ ~deNavigationSpace()

virtual deNavigationSpace::~deNavigationSpace ( )
protectedvirtual

Clean up animator.

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

◆ GetBlockerShapeList() [1/2]

decShapeList& deNavigationSpace::GetBlockerShapeList ( )
inline

Blocker shape list.

◆ GetBlockerShapeList() [2/2]

const decShapeList& deNavigationSpace::GetBlockerShapeList ( ) const
inline

◆ GetBlockingPriority()

int deNavigationSpace::GetBlockingPriority ( ) const
inline

Blocking priority.

Navigation meshes is blocked by all blockers with an equal or larger blocking priority. If a blocker shape exists it blocks all navigation meshes with equal or less blocking priority.

◆ GetCornerAt()

deNavigationSpaceCorner& deNavigationSpace::GetCornerAt ( int  index) const

Corner at the given position.

◆ GetCornerCount()

int deNavigationSpace::GetCornerCount ( ) const
inline

Number of corners.

◆ GetCorners()

deNavigationSpaceCorner* deNavigationSpace::GetCorners ( ) const
inline

Pointer to the corners.

◆ GetEdgeAt()

deNavigationSpaceEdge& deNavigationSpace::GetEdgeAt ( int  index) const

Edge at the given position.

◆ GetEdgeCount()

int deNavigationSpace::GetEdgeCount ( ) const
inline

Number of edges.

◆ GetEdges()

deNavigationSpaceEdge* deNavigationSpace::GetEdges ( ) const
inline

Pointer to the edges.

◆ GetFaceAt()

deNavigationSpaceFace& deNavigationSpace::GetFaceAt ( int  index) const

Face at the given position.

◆ GetFaceCount()

int deNavigationSpace::GetFaceCount ( ) const
inline

Number of faces.

◆ GetFaces()

deNavigationSpaceFace* deNavigationSpace::GetFaces ( ) const
inline

Pointer to the faces.

◆ GetLayer()

int deNavigationSpace::GetLayer ( ) const
inline

Layer number.

◆ GetLLWorldNext()

deNavigationSpace* deNavigationSpace::GetLLWorldNext ( ) const
inline

Next navigation space in the parent world linked list.

◆ GetLLWorldPrev()

deNavigationSpace* deNavigationSpace::GetLLWorldPrev ( ) const
inline

Previous navigation space in the parent world linked list.

◆ GetOrientation()

const decQuaternion& deNavigationSpace::GetOrientation ( ) const
inline

Orientation.

◆ GetParentWorld()

deWorld* deNavigationSpace::GetParentWorld ( ) const
inline

Parent world or NULL.

◆ GetPeerAI()

deBaseAINavigationSpace* deNavigationSpace::GetPeerAI ( ) const
inline

AI system peer.

◆ GetPosition()

const decDVector& deNavigationSpace::GetPosition ( ) const
inline

Position.

◆ GetRoomAt()

deNavigationSpaceRoom& deNavigationSpace::GetRoomAt ( int  index) const

Room at the given position.

◆ GetRoomCount()

int deNavigationSpace::GetRoomCount ( ) const
inline

Number of rooms.

◆ GetRooms()

deNavigationSpaceRoom* deNavigationSpace::GetRooms ( ) const
inline

Pointer to the rooms.

◆ GetSnapAngle()

float deNavigationSpace::GetSnapAngle ( ) const
inline

Snap angle in radians up to which edges are linked to neighbor spaces.

The default snap angle is 180° in radians.

◆ GetSnapDistance()

float deNavigationSpace::GetSnapDistance ( ) const
inline

Snap distance in meters up to which edges are linked to neighbor spaces.

The default snap distance is 0.001 (1mm).

◆ GetType()

eSpaceTypes deNavigationSpace::GetType ( ) const
inline

Space type.

◆ GetVertexAt()

const decVector& deNavigationSpace::GetVertexAt ( int  index) const

Vertex at the given position.

◆ GetVertexCount()

int deNavigationSpace::GetVertexCount ( ) const
inline

Number of vertices.

◆ GetVertices()

decVector* deNavigationSpace::GetVertices ( ) const
inline

Pointer to the vertices.

◆ GetWallAt()

deNavigationSpaceWall& deNavigationSpace::GetWallAt ( int  index) const

Wall at the given position.

◆ GetWallCount()

int deNavigationSpace::GetWallCount ( ) const
inline

Number of walls.

◆ GetWalls()

deNavigationSpaceWall* deNavigationSpace::GetWalls ( ) const
inline

Pointer to the walls.

◆ NotifyBlockerShapeListChanged()

void deNavigationSpace::NotifyBlockerShapeListChanged ( )

Notifies the peers that the blocker shape list changed.

◆ NotifyLayoutChanged()

void deNavigationSpace::NotifyLayoutChanged ( )

Notifies the peers that the layout of the navigation space changed. This has to be called after changes made to vertices, corners, faces, walls or rooms or if the space type has been changed. Call this after all changes have been done.

◆ SetBlockingPriority()

void deNavigationSpace::SetBlockingPriority ( int  priority)

Set blocking priority.

Navigation meshes is blocked by all blockers with an equal or larger blocking priority. If a blocker shape exists it blocks all navigation meshes with equal or less blocking priority.

◆ SetCornerCount()

void deNavigationSpace::SetCornerCount ( int  count)

Set number of corners.

◆ SetEdgeCount()

void deNavigationSpace::SetEdgeCount ( int  count)

Set number of edges.

◆ SetFaceCount()

void deNavigationSpace::SetFaceCount ( int  count)

Set number of faces.

◆ SetLayer()

void deNavigationSpace::SetLayer ( int  layer)

Set layer number.

◆ SetLLWorldNext()

void deNavigationSpace::SetLLWorldNext ( deNavigationSpace navspace)

Set next navigation space in the parent world linked list.

◆ SetLLWorldPrev()

void deNavigationSpace::SetLLWorldPrev ( deNavigationSpace navspace)

Set next navigation space in the parent world linked list.

◆ SetOrientation()

void deNavigationSpace::SetOrientation ( const decQuaternion orientation)

Set orientation.

◆ SetParentWorld()

void deNavigationSpace::SetParentWorld ( deWorld world)

Set parent world or NULL.

◆ SetPeerAI()

void deNavigationSpace::SetPeerAI ( deBaseAINavigationSpace peer)

Set AI system peer.

◆ SetPosition()

void deNavigationSpace::SetPosition ( const decDVector position)

Set position.

◆ SetRoomCount()

void deNavigationSpace::SetRoomCount ( int  count)

Set number of rooms.

◆ SetSnapAngle()

void deNavigationSpace::SetSnapAngle ( float  angle)

Set snap angle in radians up to which edges are linked to neighbor spaces.

The default snap angle is 180° in radians.

◆ SetSnapDistance()

void deNavigationSpace::SetSnapDistance ( float  distance)

Set snap distance in meters up to which edges are linked to neighbor spaces.

The default snap distance is 0.001 (1mm).

◆ SetType()

void deNavigationSpace::SetType ( eSpaceTypes  type)

Set space type.

◆ SetVertexAt()

void deNavigationSpace::SetVertexAt ( int  index,
const decVector vertex 
)

Set vertex at the given position.

◆ SetVertexCount()

void deNavigationSpace::SetVertexCount ( int  count)

Set number of vertices.

◆ SetWallCount()

void deNavigationSpace::SetWallCount ( int  count)

Set number of walls.

◆ Verify()

bool deNavigationSpace::Verify ( ) const

Verify the navigation space.


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