Recast Navigation
Navigationmesh Toolset for Games

Contains triangle meshes that represent detailed height data associated with the polygons in its associated polygon mesh object. More...
#include <Recast.h>
Public Member Functions  
rcPolyMeshDetail ()  
Public Attributes  
unsigned int *  meshes 
The submesh data. [Size: 4*nmeshes]. More...  
float *  verts 
The mesh vertices. [Size: 3*nverts]. More...  
unsigned char *  tris 
The mesh triangles. [Size: 4*ntris]. More...  
int  nmeshes 
The number of submeshes defined by meshes. More...  
int  nverts 
The number of vertices in verts. More...  
int  ntris 
The number of triangles in tris. More...  
Contains triangle meshes that represent detailed height data associated with the polygons in its associated polygon mesh object.
The detail mesh is made up of triangle submeshes that provide extra height detail for each polygon in its assoicated polygon mesh.
The standard process for building a detail mesh is to allocate it using rcAllocPolyMeshDetail, then build it using rcBuildPolyMeshDetail.
See the individual field definitions for details realted to the structure the mesh.
rcPolyMeshDetail::rcPolyMeshDetail  (  ) 
rcPolyMeshDetail::meshes 
The submesh data. [Size: 4*nmeshes].
[(baseVertIndex, vertCount, baseTriIndex, triCount) * nmeshes]
Maximum number of vertices per submesh: 127
Maximum number of triangles per submesh: 255
The submeshes are stored in the same order as the polygons from the rcPolyMesh they represent. E.g. rcPolyMeshDetail submesh 5 is associated with rcPolyMesh polygon 5.
Example of iterating the triangles in a submesh.
int rcPolyMeshDetail::nmeshes 
The number of submeshes defined by meshes.
int rcPolyMeshDetail::ntris 
The number of triangles in tris.
int rcPolyMeshDetail::nverts 
The number of vertices in verts.
rcPolyMeshDetail::tris 
The mesh triangles. [Size: 4*ntris].
[(vertIndexA, vertIndexB, vertIndexC, flags) * ntris]
The triangles are grouped by submesh.
Vertex Indices
The vertex indices in the triangle array are local to the submesh, not global. To translate into an global index in the vertices array, the values must be offset by the submesh's base vertex index.
Example: If the baseVertexIndex for the submesh is 5 and the triangle entry is (4, 8, 7, 0), then the actual indices for the vertices are (4 + 5, 8 + 5, 7 + 5).
Flags
The flags entry indicates which edges are internal and which are external to the submesh. Internal edges connect to other triangles within the same submesh. External edges represent portals to other submeshes or the null region.
Each flag is stored in a 2bit position. Where position 0 is the lowest 2bits and position 4 is the highest 2bits:
Position 0: Edge AB (>> 0)
Position 1: Edge BC (>> 2)
Position 2: Edge CA (>> 4)
Position 4: Unused
Testing can be performed as follows:
rcPolyMeshDetail::verts 
The mesh vertices. [Size: 3*nverts].
[(x, y, z) * nverts]
The vertices are grouped by submesh and will contain duplicates since each submesh is independently defined.
The first group of vertices for each submesh are in the same order as the vertices for the submesh's associated PolyMesh polygon. These vertices are followed by any additional detail vertices. So it the associated polygon has 5 vertices, the submesh will have a minimum of 5 vertices and the first 5 vertices will be equivalent to the 5 polygon vertices.