Recast Navigation
Navigation-mesh Toolset for Games
ChunkyTriMesh.cpp File Reference
#include "ChunkyTriMesh.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

Classes

struct  BoundsItem
 

Functions

static int compareItemX (const void *va, const void *vb)
 
static int compareItemY (const void *va, const void *vb)
 
static void calcExtends (const BoundsItem *items, const int, const int imin, const int imax, float *bmin, float *bmax)
 
int longestAxis (float x, float y)
 
static void subdivide (BoundsItem *items, int nitems, int imin, int imax, int trisPerChunk, int &curNode, rcChunkyTriMeshNode *nodes, const int maxNodes, int &curTri, int *outTris, const int *inTris)
 
bool rcCreateChunkyTriMesh (const float *verts, const int *tris, int ntris, int trisPerChunk, rcChunkyTriMesh *cm)
 Creates partitioned triangle mesh (AABB tree), where each node contains at max trisPerChunk triangles. More...
 
bool checkOverlapRect (const float amin[2], const float amax[2], const float bmin[2], const float bmax[2])
 
int rcGetChunksOverlappingRect (const rcChunkyTriMesh *cm, float bmin[2], float bmax[2], int *ids, const int maxIds)
 Returns the chunk indices which overlap the input rectable. More...
 
static bool checkOverlapSegment (const float p[2], const float q[2], const float bmin[2], const float bmax[2])
 
int rcGetChunksOverlappingSegment (const rcChunkyTriMesh *cm, float p[2], float q[2], int *ids, const int maxIds)
 Returns the chunk indices which overlap the input segment. More...
 

Function Documentation

◆ calcExtends()

static void calcExtends ( const BoundsItem items,
const int  ,
const int  imin,
const int  imax,
float *  bmin,
float *  bmax 
)
static

◆ checkOverlapRect()

bool checkOverlapRect ( const float  amin[2],
const float  amax[2],
const float  bmin[2],
const float  bmax[2] 
)
inline

◆ checkOverlapSegment()

static bool checkOverlapSegment ( const float  p[2],
const float  q[2],
const float  bmin[2],
const float  bmax[2] 
)
static

◆ compareItemX()

static int compareItemX ( const void *  va,
const void *  vb 
)
static

◆ compareItemY()

static int compareItemY ( const void *  va,
const void *  vb 
)
static

◆ longestAxis()

int longestAxis ( float  x,
float  y 
)
inline

◆ rcCreateChunkyTriMesh()

bool rcCreateChunkyTriMesh ( const float *  verts,
const int *  tris,
int  ntris,
int  trisPerChunk,
rcChunkyTriMesh cm 
)

Creates partitioned triangle mesh (AABB tree), where each node contains at max trisPerChunk triangles.

◆ rcGetChunksOverlappingRect()

int rcGetChunksOverlappingRect ( const rcChunkyTriMesh cm,
float  bmin[2],
float  bmax[2],
int *  ids,
const int  maxIds 
)

Returns the chunk indices which overlap the input rectable.

◆ rcGetChunksOverlappingSegment()

int rcGetChunksOverlappingSegment ( const rcChunkyTriMesh cm,
float  p[2],
float  q[2],
int *  ids,
const int  maxIds 
)

Returns the chunk indices which overlap the input segment.

◆ subdivide()

static void subdivide ( BoundsItem items,
int  nitems,
int  imin,
int  imax,
int  trisPerChunk,
int &  curNode,
rcChunkyTriMeshNode nodes,
const int  maxNodes,
int &  curTri,
int *  outTris,
const int *  inTris 
)
static