Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Menge::NavMeshLocation Class Reference

Class for indicating how the location of the agent is defined. Either by a portal path or a node. More...

#include <NavMeshLocalizer.h>

Public Member Functions

 NavMeshLocation ()
 Default constructor.
 
 NavMeshLocation (unsigned int nodeID)
 Constructor Initializes the location to being a node id. More...
 
 NavMeshLocation (PortalPath *path)
 Constructor Initializes the location to being a path. The NavMeshLocation takes responsibility for deleting the path. More...
 
void setNode (unsigned int nodeID)
 Sets the current position to being a node. More...
 
void clearPath ()
 Clears the path (if any), maintaining the node location.
 
unsigned int getNode () const
 Reports the node the agent is currently in. More...
 
void setPath (PortalPath *path)
 Sets the current position to being the given path. More...
 
bool isPath () const
 Reports if the location is a path. More...
 
bool isNode () const
 Reports if the location is a node. More...
 

Public Attributes

union {
   size_t   _nodeID
 
   PortalPath *   _path
 
}; 
 Location information. If the agent has a path it is a pointer to that path. Otherwise, it is an index into the navigation mesh.
 
bool _hasPath
 Determines interpretation of the location union. If true, _path contains a pointer. Otherwise, _nodeID is an index in the navigation mesh.
 

Static Public Attributes

static const unsigned int NO_NODE = std::numeric_limits< unsigned int >::max()
 Signal for indicating that the position is NOT on the navigation mesh.
 

Detailed Description

Class for indicating how the location of the agent is defined. Either by a portal path or a node.

Constructor & Destructor Documentation

Menge::NavMeshLocation::NavMeshLocation ( unsigned int  nodeID)
inline

Constructor Initializes the location to being a node id.

Parameters
nodeIDThe identifier of a nav mesh node.
Menge::NavMeshLocation::NavMeshLocation ( PortalPath path)
inline

Constructor Initializes the location to being a path. The NavMeshLocation takes responsibility for deleting the path.

Parameters
pathA pointer to a path. This class takes responsibility for freeing the memory.

Member Function Documentation

unsigned int Menge::NavMeshLocation::getNode ( ) const

Reports the node the agent is currently in.

Returns
The index of the node associated with this location. If the location is not on a node, PortalPath::NO_NODE is returned.
bool Menge::NavMeshLocation::isNode ( ) const
inline

Reports if the location is a node.

Returns
True if the location is a node, false if a path.
bool Menge::NavMeshLocation::isPath ( ) const
inline

Reports if the location is a path.

Returns
True if the location is a path, false if a node.
void Menge::NavMeshLocation::setNode ( unsigned int  nodeID)

Sets the current position to being a node.

Parameters
nodeIDThe identifier of the navigation mesh node for the location. If the location was previously a path, the path is deleted.
void Menge::NavMeshLocation::setPath ( PortalPath path)

Sets the current position to being the given path.

Parameters
pathThe path for defining the current location. The locator takes responsibility for deleting the path.

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