Recast Navigation
Navigation-mesh Toolset for Games
|
Represents a polygon mesh suitable for use in building a navigation mesh. More...
#include <Recast.h>
Public Member Functions | |
rcPolyMesh () | |
~rcPolyMesh () | |
Public Attributes | |
unsigned short * | verts |
The mesh vertices. [Form: (x, y, z) * nverts]. More... | |
unsigned short * | polys |
Polygon and neighbor data. [Length: maxpolys * 2 * nvp]. More... | |
unsigned short * | regs |
The region id assigned to each polygon. [Length: maxpolys]. More... | |
unsigned short * | flags |
The user defined flags for each polygon. [Length: maxpolys]. More... | |
unsigned char * | areas |
The area id assigned to each polygon. [Length: maxpolys]. More... | |
int | nverts |
The number of vertices. More... | |
int | npolys |
The number of polygons. More... | |
int | maxpolys |
The number of allocated polygons. More... | |
int | nvp |
The maximum number of vertices per polygon. More... | |
float | bmin [3] |
The minimum bounds in world space. [(x, y, z)]. More... | |
float | bmax [3] |
The maximum bounds in world space. [(x, y, z)]. More... | |
float | cs |
The size of each cell. (On the xz-plane.) More... | |
float | ch |
The height of each cell. (The minimum increment along the y-axis.) More... | |
int | borderSize |
The AABB border size used to generate the source data from which the mesh was derived. More... | |
float | maxEdgeError |
The max error of the polygon edges in the mesh. More... | |
Represents a polygon mesh suitable for use in building a navigation mesh.
A mesh of potentially overlapping convex polygons of between three and nvp vertices. The mesh exists within the context of an axis-aligned bounding box (AABB) with vertices laid out in an evenly spaced grid, based on the values of cs and ch.
The standard process for building a contour set is to allocate it using rcAllocPolyMesh, the initialize it using rcBuildPolyMesh
Example of iterating the polygons:
rcPolyMesh::rcPolyMesh | ( | ) |
rcPolyMesh::~rcPolyMesh | ( | ) |
rcPolyMesh::areas |
The area id assigned to each polygon. [Length: maxpolys].
The standard build process assigns the value of RC_WALKABLE_AREA to all walkable polygons. This value can then be changed to meet user requirements.
float rcPolyMesh::bmax[3] |
The maximum bounds in world space. [(x, y, z)].
float rcPolyMesh::bmin[3] |
The minimum bounds in world space. [(x, y, z)].
int rcPolyMesh::borderSize |
The AABB border size used to generate the source data from which the mesh was derived.
float rcPolyMesh::ch |
The height of each cell. (The minimum increment along the y-axis.)
float rcPolyMesh::cs |
The size of each cell. (On the xz-plane.)
unsigned short* rcPolyMesh::flags |
The user defined flags for each polygon. [Length: maxpolys].
float rcPolyMesh::maxEdgeError |
The max error of the polygon edges in the mesh.
int rcPolyMesh::maxpolys |
The number of allocated polygons.
int rcPolyMesh::npolys |
The number of polygons.
int rcPolyMesh::nverts |
The number of vertices.
int rcPolyMesh::nvp |
The maximum number of vertices per polygon.
rcPolyMesh::polys |
Polygon and neighbor data. [Length: maxpolys * 2 * nvp].
Each entry is 2 * nvp
in length. The first half of the entry contains the indices of the polygon. The first instance of RC_MESH_NULL_IDX indicates the end of the indices for the entry. The second half contains indices to neighbor polygons. A value of RC_MESH_NULL_IDX indicates no connection for the associated edge. (I.e. The edge is a solid border.)
For example:
nvp = 6 For the entry: (1, 3, 4, 8, RC_MESH_NULL_IDX, RC_MESH_NULL_IDX, 18, RC_MESH_NULL_IDX , 21, RC_MESH_NULL_IDX, RC_MESH_NULL_IDX, RC_MESH_NULL_IDX) (1, 3, 4, 8) defines a polygon with 4 vertices. Edge 1->3 is shared with polygon 18. Edge 4->8 is shared with polygon 21. Edges 3->4 and 4->8 are border edges not shared with any other polygon.
unsigned short* rcPolyMesh::regs |
The region id assigned to each polygon. [Length: maxpolys].
rcPolyMesh::verts |
The mesh vertices. [Form: (x, y, z) * nverts].
The values of bmin ,cs, and ch are used to convert vertex coordinates to world space as follows: