Recast Navigation  1.0.35
DetourTileCacheBuilder.cpp File Reference
#include "DetourCommon.h"
#include "DetourMath.h"
#include "DetourStatus.h"
#include "DetourAssert.h"
#include "DetourTileCacheBuilder.h"
#include <string.h>

Classes

class  dtFixedArray< T >
 
struct  dtLayerSweepSpan
 
struct  dtLayerMonotoneRegion
 
struct  dtTempContour
 
struct  rcEdge
 

Functions

int getDirOffsetX (int dir)
 
int getDirOffsetY (int dir)
 
dtTileCacheContourSetdtAllocTileCacheContourSet (dtTileCacheAlloc *alloc)
 
void dtFreeTileCacheContourSet (dtTileCacheAlloc *alloc, dtTileCacheContourSet *cset)
 
dtTileCachePolyMeshdtAllocTileCachePolyMesh (dtTileCacheAlloc *alloc)
 
void dtFreeTileCachePolyMesh (dtTileCacheAlloc *alloc, dtTileCachePolyMesh *lmesh)
 
bool overlapRangeExl (const unsigned short amin, const unsigned short amax, const unsigned short bmin, const unsigned short bmax)
 
static void addUniqueLast (unsigned char *a, unsigned char &an, unsigned char v)
 
bool isConnected (const dtTileCacheLayer &layer, const int ia, const int ib, const int walkableClimb)
 
static bool canMerge (unsigned char oldRegId, unsigned char newRegId, const dtLayerMonotoneRegion *regs, const int nregs)
 
dtStatus dtBuildTileCacheRegions (dtTileCacheAlloc *alloc, dtTileCacheLayer &layer, const int walkableClimb)
 
static bool appendVertex (dtTempContour &cont, const int x, const int y, const int z, const int r)
 
static unsigned char getNeighbourReg (dtTileCacheLayer &layer, const int ax, const int ay, const int dir)
 
static bool walkContour (dtTileCacheLayer &layer, int x, int y, dtTempContour &cont)
 
static float distancePtSeg (const int x, const int z, const int px, const int pz, const int qx, const int qz)
 
static void simplifyContour (dtTempContour &cont, const float maxError)
 
static unsigned char getCornerHeight (dtTileCacheLayer &layer, const int x, const int y, const int z, const int walkableClimb, bool &shouldRemove)
 
dtStatus dtBuildTileCacheContours (dtTileCacheAlloc *alloc, dtTileCacheLayer &layer, const int walkableClimb, const float maxError, dtTileCacheContourSet &lcset)
 
int computeVertexHash2 (int x, int y, int z)
 
static unsigned short addVertex (unsigned short x, unsigned short y, unsigned short z, unsigned short *verts, unsigned short *firstVert, unsigned short *nextVert, int &nv)
 
static bool buildMeshAdjacency (dtTileCacheAlloc *alloc, unsigned short *polys, const int npolys, const unsigned short *verts, const int nverts, const dtTileCacheContourSet &lcset)
 
int prev (int i, int n)
 
int next (int i, int n)
 
int area2 (const unsigned char *a, const unsigned char *b, const unsigned char *c)
 
bool xorb (bool x, bool y)
 
bool left (const unsigned char *a, const unsigned char *b, const unsigned char *c)
 
bool leftOn (const unsigned char *a, const unsigned char *b, const unsigned char *c)
 
bool collinear (const unsigned char *a, const unsigned char *b, const unsigned char *c)
 
static bool intersectProp (const unsigned char *a, const unsigned char *b, const unsigned char *c, const unsigned char *d)
 
static bool between (const unsigned char *a, const unsigned char *b, const unsigned char *c)
 
static bool intersect (const unsigned char *a, const unsigned char *b, const unsigned char *c, const unsigned char *d)
 
static bool vequal (const unsigned char *a, const unsigned char *b)
 
static bool diagonalie (int i, int j, int n, const unsigned char *verts, const unsigned short *indices)
 
static bool inCone (int i, int j, int n, const unsigned char *verts, const unsigned short *indices)
 
static bool diagonal (int i, int j, int n, const unsigned char *verts, const unsigned short *indices)
 
static int triangulate (int n, const unsigned char *verts, unsigned short *indices, unsigned short *tris)
 
template<typename T >
static int countPolyVerts (const T *p)
 
template<typename T >
bool uleft (const T *a, const T *b, const T *c)
 
template<typename T , typename U >
static int getPolyMergeValue (T *pa, T *pb, const U *verts, int &ea, int &eb)
 
template<typename T >
static void mergePolys (T *pa, T *pb, int ea, int eb)
 
static void pushFront (navIndexType v, navIndexType *arr, int &an)
 
static void pushBack (navIndexType v, navIndexType *arr, int &an)
 
static bool canRemoveVertex (dtTileCachePolyMesh &mesh, const unsigned short rem)
 
static dtStatus removeVertex (dtTileCachePolyMesh &mesh, const unsigned short rem, const int maxTris)
 
dtStatus dtBuildTileCachePolyMesh (dtTileCacheAlloc *alloc, dtTileCacheContourSet &lcset, dtTileCachePolyMesh &mesh)
 
dtStatus dtMarkCylinderArea (dtTileCacheLayer &layer, const float *orig, const float cs, const float ch, const float *pos, const float radius, const float height, const unsigned char areaId)
 
dtStatus dtBuildTileCacheLayer (dtTileCacheCompressor *comp, dtTileCacheLayerHeader *header, const unsigned char *heights, const navAreaMask *areaMasks, const unsigned char *cons, unsigned char **outData, int *outDataSize)
 
void dtFreeTileCacheLayer (dtTileCacheAlloc *alloc, dtTileCacheLayer *layer)
 
dtStatus dtDecompressTileCacheLayer (dtTileCacheAlloc *alloc, dtTileCacheCompressor *comp, unsigned char *compressed, const int compressedSize, dtTileCacheLayer **layerOut)
 
bool dtTileCacheHeaderSwapEndian (unsigned char *data, const int)
 Swaps the endianess of the compressed tile data's header (dtTileCacheLayerHeader). More...
 

Variables

static const int MAX_VERTS_PER_POLY = 6
 
static const int MAX_REM_EDGES = 48
 
static const int DT_LAYER_MAX_NEIS = 16
 
static const int VERTEX_BUCKET_COUNT2 = (1<<8)
 

Function Documentation

static void addUniqueLast ( unsigned char *  a,
unsigned char &  an,
unsigned char  v 
)
static
static unsigned short addVertex ( unsigned short  x,
unsigned short  y,
unsigned short  z,
unsigned short *  verts,
unsigned short *  firstVert,
unsigned short *  nextVert,
int &  nv 
)
static
static bool appendVertex ( dtTempContour cont,
const int  x,
const int  y,
const int  z,
const int  r 
)
static
int area2 ( const unsigned char *  a,
const unsigned char *  b,
const unsigned char *  c 
)
inline
static bool between ( const unsigned char *  a,
const unsigned char *  b,
const unsigned char *  c 
)
static
static bool buildMeshAdjacency ( dtTileCacheAlloc alloc,
unsigned short *  polys,
const int  npolys,
const unsigned short *  verts,
const int  nverts,
const dtTileCacheContourSet lcset 
)
static
static bool canMerge ( unsigned char  oldRegId,
unsigned char  newRegId,
const dtLayerMonotoneRegion regs,
const int  nregs 
)
static
static bool canRemoveVertex ( dtTileCachePolyMesh mesh,
const unsigned short  rem 
)
static
bool collinear ( const unsigned char *  a,
const unsigned char *  b,
const unsigned char *  c 
)
inline
int computeVertexHash2 ( int  x,
int  y,
int  z 
)
inline
template<typename T >
static int countPolyVerts ( const T *  p)
static
static bool diagonal ( int  i,
int  j,
int  n,
const unsigned char *  verts,
const unsigned short *  indices 
)
static
static bool diagonalie ( int  i,
int  j,
int  n,
const unsigned char *  verts,
const unsigned short *  indices 
)
static
static float distancePtSeg ( const int  x,
const int  z,
const int  px,
const int  pz,
const int  qx,
const int  qz 
)
static
dtTileCacheContourSet* dtAllocTileCacheContourSet ( dtTileCacheAlloc alloc)
dtTileCachePolyMesh* dtAllocTileCachePolyMesh ( dtTileCacheAlloc alloc)
dtStatus dtBuildTileCacheContours ( dtTileCacheAlloc alloc,
dtTileCacheLayer layer,
const int  walkableClimb,
const float  maxError,
dtTileCacheContourSet lcset 
)
dtStatus dtBuildTileCacheLayer ( dtTileCacheCompressor comp,
dtTileCacheLayerHeader header,
const unsigned char *  heights,
const navAreaMask *  areaMasks,
const unsigned char *  cons,
unsigned char **  outData,
int *  outDataSize 
)
dtStatus dtBuildTileCachePolyMesh ( dtTileCacheAlloc alloc,
dtTileCacheContourSet lcset,
dtTileCachePolyMesh mesh 
)
dtStatus dtBuildTileCacheRegions ( dtTileCacheAlloc alloc,
dtTileCacheLayer layer,
const int  walkableClimb 
)
dtStatus dtDecompressTileCacheLayer ( dtTileCacheAlloc alloc,
dtTileCacheCompressor comp,
unsigned char *  compressed,
const int  compressedSize,
dtTileCacheLayer **  layerOut 
)
void dtFreeTileCacheContourSet ( dtTileCacheAlloc alloc,
dtTileCacheContourSet cset 
)
void dtFreeTileCacheLayer ( dtTileCacheAlloc alloc,
dtTileCacheLayer layer 
)
void dtFreeTileCachePolyMesh ( dtTileCacheAlloc alloc,
dtTileCachePolyMesh lmesh 
)
dtStatus dtMarkCylinderArea ( dtTileCacheLayer layer,
const float *  orig,
const float  cs,
const float  ch,
const float *  pos,
const float  radius,
const float  height,
const unsigned char  areaId 
)
bool dtTileCacheHeaderSwapEndian ( unsigned char *  data,
const int  dataSize 
)

Swaps the endianess of the compressed tile data's header (dtTileCacheLayerHeader).

Tile layer data does not need endian swapping as it consits only of bytes.

Parameters
[in,out]dataThe tile data array.
[in]dataSizeThe size of the data array.
static unsigned char getCornerHeight ( dtTileCacheLayer layer,
const int  x,
const int  y,
const int  z,
const int  walkableClimb,
bool &  shouldRemove 
)
static
int getDirOffsetX ( int  dir)
inline
int getDirOffsetY ( int  dir)
inline
static unsigned char getNeighbourReg ( dtTileCacheLayer layer,
const int  ax,
const int  ay,
const int  dir 
)
static
template<typename T , typename U >
static int getPolyMergeValue ( T *  pa,
T *  pb,
const U *  verts,
int &  ea,
int &  eb 
)
static
static bool inCone ( int  i,
int  j,
int  n,
const unsigned char *  verts,
const unsigned short *  indices 
)
static
static bool intersect ( const unsigned char *  a,
const unsigned char *  b,
const unsigned char *  c,
const unsigned char *  d 
)
static
static bool intersectProp ( const unsigned char *  a,
const unsigned char *  b,
const unsigned char *  c,
const unsigned char *  d 
)
static
bool isConnected ( const dtTileCacheLayer layer,
const int  ia,
const int  ib,
const int  walkableClimb 
)
inline
bool left ( const unsigned char *  a,
const unsigned char *  b,
const unsigned char *  c 
)
inline
bool leftOn ( const unsigned char *  a,
const unsigned char *  b,
const unsigned char *  c 
)
inline
template<typename T >
static void mergePolys ( T *  pa,
T *  pb,
int  ea,
int  eb 
)
static
int next ( int  i,
int  n 
)
inline
bool overlapRangeExl ( const unsigned short  amin,
const unsigned short  amax,
const unsigned short  bmin,
const unsigned short  bmax 
)
inline
int prev ( int  i,
int  n 
)
inline
static void pushBack ( navIndexType  v,
navIndexType *  arr,
int &  an 
)
static
static void pushFront ( navIndexType  v,
navIndexType *  arr,
int &  an 
)
static
static dtStatus removeVertex ( dtTileCachePolyMesh mesh,
const unsigned short  rem,
const int  maxTris 
)
static
static void simplifyContour ( dtTempContour cont,
const float  maxError 
)
static
static int triangulate ( int  n,
const unsigned char *  verts,
unsigned short *  indices,
unsigned short *  tris 
)
static
template<typename T >
bool uleft ( const T *  a,
const T *  b,
const T *  c 
)
inline
static bool vequal ( const unsigned char *  a,
const unsigned char *  b 
)
static
static bool walkContour ( dtTileCacheLayer layer,
int  x,
int  y,
dtTempContour cont 
)
static
bool xorb ( bool  x,
bool  y 
)
inline

Variable Documentation

const int DT_LAYER_MAX_NEIS = 16
static
const int MAX_REM_EDGES = 48
static
const int MAX_VERTS_PER_POLY = 6
static
const int VERTEX_BUCKET_COUNT2 = (1<<8)
static