Drag[en]gine Game Engine  1.0
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 }
 

Public Member Functions

Management
eSpaceTypes GetType () const
 
void SetType (eSpaceTypes type)
 
int GetLayer () const
 
void SetLayer (int layer)
 
const decDVectorGetPosition () const
 
void SetPosition (const decDVector &position)
 
const decQuaternionGetOrientation () const
 
void SetOrientation (const decQuaternion &orientation)
 
float GetSnapDistance () const
 Retrieves the snap distance in meters up to which edges are linked to neighbor spaces. More...
 
void SetSnapDistance (float distance)
 Sets the snap distance in meters up to which edges are linked to neighbor spaces. More...
 
float GetSnapAngle () const
 Retrieves the snap angle in radians up to which edges are linked to neighbor spaces. More...
 
void SetSnapAngle (float angle)
 Sets the snap angle in radians up to which edges are linked to neighbor spaces. More...
 
decShapeListGetBlockerShapeList ()
 Retrieves the 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
 
Vertices
int GetVertexCount () const
 
void SetVertexCount (int count)
 
const decVectorGetVertexAt (int index) const
 
void SetVertexAt (int index, const decVector &vertex)
 
decVectorGetVertices () const
 
Edges
int GetEdgeCount () const
 
void SetEdgeCount (int count)
 
deNavigationSpaceEdgeGetEdgeAt (int index) const
 
deNavigationSpaceEdgeGetEdges () const
 
Corners
int GetCornerCount () const
 
void SetCornerCount (int count)
 
deNavigationSpaceCornerGetCornerAt (int index) const
 
deNavigationSpaceCornerGetCorners () const
 
Faces
int GetFaceCount () const
 
void SetFaceCount (int count)
 
deNavigationSpaceFaceGetFaceAt (int index) const
 
deNavigationSpaceFaceGetFaces () const
 
Walls
int GetWallCount () const
 
void SetWallCount (int count)
 
deNavigationSpaceWallGetWallAt (int index) const
 
deNavigationSpaceWallGetWalls () const
 
Rooms
int GetRoomCount () const
 
void SetRoomCount (int count)
 
deNavigationSpaceRoomGetRoomAt (int index) const
 
deNavigationSpaceRoomGetRooms () const
 
System Peers
deBaseAINavigationSpaceGetPeerAI () const
 
void SetPeerAI (deBaseAINavigationSpace *peer)
 
Linked List
deWorldGetParentWorld () const
 
void SetParentWorld (deWorld *world)
 
deNavigationSpaceGetLLWorldPrev () const
 
void SetLLWorldPrev (deNavigationSpace *navspace)
 
deNavigationSpaceGetLLWorldNext () const
 
void SetLLWorldNext (deNavigationSpace *navspace)
 
- 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)
 
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.
Author
Plüss Roland
Version
1.0
Date
2011

Member Enumeration Documentation

◆ eSpaceTypes

Space Type.

Enumerator
estGrid 

Navigation Grid.

estMesh 

Navigation Mesh.

estVolume 

Navigation Volume.

Constructor & Destructor Documentation

◆ deNavigationSpace()

deNavigationSpace::deNavigationSpace ( deNavigationSpaceManager manager)

Creates a 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

Retrieves the 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.

References NotifyLayoutChanged(), SetBlockingPriority(), and Verify().

◆ GetCornerAt()

deNavigationSpaceCorner& deNavigationSpace::GetCornerAt ( int  index) const

Retrieves the corner at the given position.

Referenced by GetCornerCount().

◆ GetCornerCount()

int deNavigationSpace::GetCornerCount ( ) const
inline

Retrieves the number of corners.

References GetCornerAt(), and SetCornerCount().

◆ GetCorners()

deNavigationSpaceCorner* deNavigationSpace::GetCorners ( ) const
inline

Retrieves the pointer to the corners.

◆ GetEdgeAt()

deNavigationSpaceEdge& deNavigationSpace::GetEdgeAt ( int  index) const

Retrieves the edge at the given position.

Referenced by GetEdgeCount().

◆ GetEdgeCount()

int deNavigationSpace::GetEdgeCount ( ) const
inline

Retrieves the number of edges.

References GetEdgeAt(), and SetEdgeCount().

◆ GetEdges()

deNavigationSpaceEdge* deNavigationSpace::GetEdges ( ) const
inline

Retrieves the pointer to the edges.

◆ GetFaceAt()

deNavigationSpaceFace& deNavigationSpace::GetFaceAt ( int  index) const

Retrieves the face at the given position.

Referenced by GetFaceCount().

◆ GetFaceCount()

int deNavigationSpace::GetFaceCount ( ) const
inline

Retrieves the number of faces.

References GetFaceAt(), and SetFaceCount().

◆ GetFaces()

deNavigationSpaceFace* deNavigationSpace::GetFaces ( ) const
inline

Retrieves the pointer to the faces.

◆ GetLayer()

int deNavigationSpace::GetLayer ( ) const
inline

Retrieves the layer number.

References SetLayer().

◆ GetLLWorldNext()

deNavigationSpace* deNavigationSpace::GetLLWorldNext ( ) const
inline

Retrieves the next navigation space in the parent world linked list.

References SetLLWorldNext().

◆ GetLLWorldPrev()

deNavigationSpace* deNavigationSpace::GetLLWorldPrev ( ) const
inline

Retrieves the previous navigation space in the parent world linked list.

References SetLLWorldPrev().

◆ GetOrientation()

const decQuaternion& deNavigationSpace::GetOrientation ( ) const
inline

Retrieves the orientation.

References SetOrientation().

◆ GetParentWorld()

deWorld* deNavigationSpace::GetParentWorld ( ) const
inline

Retrieves the parent world or NULL.

References SetParentWorld().

◆ GetPeerAI()

deBaseAINavigationSpace* deNavigationSpace::GetPeerAI ( ) const
inline

Retrieves the AI system peer.

References SetPeerAI().

◆ GetPosition()

const decDVector& deNavigationSpace::GetPosition ( ) const
inline

Retrieves the position.

References SetPosition().

◆ GetRoomAt()

deNavigationSpaceRoom& deNavigationSpace::GetRoomAt ( int  index) const

Retrieves the room at the given position.

Referenced by GetRoomCount().

◆ GetRoomCount()

int deNavigationSpace::GetRoomCount ( ) const
inline

Retrieves the number of rooms.

References GetRoomAt(), and SetRoomCount().

◆ GetRooms()

deNavigationSpaceRoom* deNavigationSpace::GetRooms ( ) const
inline

Retrieves the pointer to the rooms.

◆ GetSnapAngle()

float deNavigationSpace::GetSnapAngle ( ) const
inline

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

The default snap angle is 180° in radians.

References SetSnapAngle().

◆ GetSnapDistance()

float deNavigationSpace::GetSnapDistance ( ) const
inline

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

The default snap distance is 0.001 (1mm).

References SetSnapDistance().

◆ GetType()

eSpaceTypes deNavigationSpace::GetType ( ) const
inline

Retrieves the space type.

References SetType().

◆ GetVertexAt()

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

Retrieves the vertex at the given position.

Referenced by GetVertexCount().

◆ GetVertexCount()

int deNavigationSpace::GetVertexCount ( ) const
inline

Retrieves the number of vertices.

References GetVertexAt(), SetVertexAt(), and SetVertexCount().

◆ GetVertices()

decVector* deNavigationSpace::GetVertices ( ) const
inline

Retrieves the pointer to the vertices.

◆ GetWallAt()

deNavigationSpaceWall& deNavigationSpace::GetWallAt ( int  index) const

Retrieves the wall at the given position.

Referenced by GetWallCount().

◆ GetWallCount()

int deNavigationSpace::GetWallCount ( ) const
inline

Retrieves the number of walls.

References GetWallAt(), and SetWallCount().

◆ GetWalls()

deNavigationSpaceWall* deNavigationSpace::GetWalls ( ) const
inline

Retrieves the pointer to the walls.

◆ NotifyBlockerShapeListChanged()

void deNavigationSpace::NotifyBlockerShapeListChanged ( )

Notifies the peers that the blocker shape list changed.

Referenced by GetBlockerShapeList().

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

Referenced by GetBlockingPriority().

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

Referenced by GetBlockingPriority().

◆ SetCornerCount()

void deNavigationSpace::SetCornerCount ( int  count)

Sets the number of corners.

Referenced by GetCornerCount().

◆ SetEdgeCount()

void deNavigationSpace::SetEdgeCount ( int  count)

Sets the number of edges.

Referenced by GetEdgeCount().

◆ SetFaceCount()

void deNavigationSpace::SetFaceCount ( int  count)

Sets the number of faces.

Referenced by GetFaceCount().

◆ SetLayer()

void deNavigationSpace::SetLayer ( int  layer)

Sets the layer number.

Referenced by GetLayer().

◆ SetLLWorldNext()

void deNavigationSpace::SetLLWorldNext ( deNavigationSpace navspace)

Sets the next navigation space in the parent world linked list.

Referenced by GetLLWorldNext().

◆ SetLLWorldPrev()

void deNavigationSpace::SetLLWorldPrev ( deNavigationSpace navspace)

Sets the next navigation space in the parent world linked list.

Referenced by GetLLWorldPrev().

◆ SetOrientation()

void deNavigationSpace::SetOrientation ( const decQuaternion orientation)

Sets the orientation.

Referenced by GetOrientation().

◆ SetParentWorld()

void deNavigationSpace::SetParentWorld ( deWorld world)

Sets the parent world or NULL.

Referenced by GetParentWorld().

◆ SetPeerAI()

void deNavigationSpace::SetPeerAI ( deBaseAINavigationSpace peer)

Sets the AI system peer.

Referenced by GetPeerAI().

◆ SetPosition()

void deNavigationSpace::SetPosition ( const decDVector position)

Sets the position.

Referenced by GetPosition().

◆ SetRoomCount()

void deNavigationSpace::SetRoomCount ( int  count)

Sets the number of rooms.

Referenced by GetRoomCount().

◆ SetSnapAngle()

void deNavigationSpace::SetSnapAngle ( float  angle)

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

The default snap angle is 180° in radians.

Referenced by GetSnapAngle().

◆ SetSnapDistance()

void deNavigationSpace::SetSnapDistance ( float  distance)

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

The default snap distance is 0.001 (1mm).

Referenced by GetSnapDistance().

◆ SetType()

void deNavigationSpace::SetType ( eSpaceTypes  type)

Sets the space type.

Referenced by GetType().

◆ SetVertexAt()

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

Sets the vertex at the given position.

Referenced by GetVertexCount().

◆ SetVertexCount()

void deNavigationSpace::SetVertexCount ( int  count)

Sets the number of vertices.

Referenced by GetVertexCount().

◆ SetWallCount()

void deNavigationSpace::SetWallCount ( int  count)

Sets the number of walls.

Referenced by GetWallCount().

◆ Verify()

bool deNavigationSpace::Verify ( ) const

Verify the navigation space.

Referenced by GetBlockingPriority().


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