Recast Navigation
Navigation-mesh Toolset for Games
RecastRegion.cpp File Reference
#include <float.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "Recast.h"
#include "RecastAlloc.h"
#include "RecastAssert.h"

Classes

struct  DirtyEntry
 
struct  rcRegion
 
struct  rcSweepSpan
 

Functions

static void calculateDistanceField (rcCompactHeightfield &chf, unsigned short *src, unsigned short &maxDist)
 
static unsigned short * boxBlur (rcCompactHeightfield &chf, int thr, unsigned short *src, unsigned short *dst)
 
static bool floodRegion (int x, int y, int i, unsigned short level, unsigned short r, rcCompactHeightfield &chf, unsigned short *srcReg, unsigned short *srcDist, rcTempVector< LevelStackEntry > &stack)
 
static void expandRegions (int maxIter, unsigned short level, rcCompactHeightfield &chf, unsigned short *srcReg, unsigned short *srcDist, rcTempVector< LevelStackEntry > &stack, bool fillStack)
 
static void sortCellsByLevel (unsigned short startLevel, rcCompactHeightfield &chf, const unsigned short *srcReg, unsigned int nbStacks, rcTempVector< LevelStackEntry > *stacks, unsigned short loglevelsPerStack)
 
static void appendStacks (const rcTempVector< LevelStackEntry > &srcStack, rcTempVector< LevelStackEntry > &dstStack, const unsigned short *srcReg)
 
static void removeAdjacentNeighbours (rcRegion &reg)
 
static void replaceNeighbour (rcRegion &reg, unsigned short oldId, unsigned short newId)
 
static bool canMergeWithRegion (const rcRegion &rega, const rcRegion &regb)
 
static void addUniqueFloorRegion (rcRegion &reg, int n)
 
static bool mergeRegions (rcRegion &rega, rcRegion &regb)
 
static bool isRegionConnectedToBorder (const rcRegion &reg)
 
static bool isSolidEdge (rcCompactHeightfield &chf, const unsigned short *srcReg, int x, int y, int i, int dir)
 
static void walkContour (int x, int y, int i, int dir, rcCompactHeightfield &chf, const unsigned short *srcReg, rcIntArray &cont)
 
static bool mergeAndFilterRegions (rcContext *ctx, int minRegionArea, int mergeRegionSize, unsigned short &maxRegionId, rcCompactHeightfield &chf, unsigned short *srcReg, rcIntArray &overlaps)
 
static void addUniqueConnection (rcRegion &reg, int n)
 
static bool mergeAndFilterLayerRegions (rcContext *ctx, int minRegionArea, unsigned short &maxRegionId, rcCompactHeightfield &chf, unsigned short *srcReg)
 
bool rcBuildDistanceField (rcContext *ctx, rcCompactHeightfield &chf)
 Builds the distance field for the specified compact heightfield. More...
 
static void paintRectRegion (int minx, int maxx, int miny, int maxy, unsigned short regId, rcCompactHeightfield &chf, unsigned short *srcReg)
 
bool rcBuildRegionsMonotone (rcContext *ctx, rcCompactHeightfield &chf, const int borderSize, const int minRegionArea, const int mergeRegionArea)
 Builds region data for the heightfield using simple monotone partitioning. More...
 
bool rcBuildRegions (rcContext *ctx, rcCompactHeightfield &chf, const int borderSize, const int minRegionArea, const int mergeRegionArea)
 Builds region data for the heightfield using watershed partitioning. More...
 
bool rcBuildLayerRegions (rcContext *ctx, rcCompactHeightfield &chf, const int borderSize, const int minRegionArea)
 Builds region data for the heightfield by partitioning the heightfield in non-overlapping layers. More...
 

Variables

static const unsigned short RC_NULL_NEI = 0xffff
 

Function Documentation

◆ addUniqueConnection()

static void addUniqueConnection ( rcRegion reg,
int  n 
)
static

◆ addUniqueFloorRegion()

static void addUniqueFloorRegion ( rcRegion reg,
int  n 
)
static

◆ appendStacks()

static void appendStacks ( const rcTempVector< LevelStackEntry > &  srcStack,
rcTempVector< LevelStackEntry > &  dstStack,
const unsigned short *  srcReg 
)
static

◆ boxBlur()

static unsigned short* boxBlur ( rcCompactHeightfield chf,
int  thr,
unsigned short *  src,
unsigned short *  dst 
)
static

◆ calculateDistanceField()

static void calculateDistanceField ( rcCompactHeightfield chf,
unsigned short *  src,
unsigned short &  maxDist 
)
static

◆ canMergeWithRegion()

static bool canMergeWithRegion ( const rcRegion rega,
const rcRegion regb 
)
static

◆ expandRegions()

static void expandRegions ( int  maxIter,
unsigned short  level,
rcCompactHeightfield chf,
unsigned short *  srcReg,
unsigned short *  srcDist,
rcTempVector< LevelStackEntry > &  stack,
bool  fillStack 
)
static

◆ floodRegion()

static bool floodRegion ( int  x,
int  y,
int  i,
unsigned short  level,
unsigned short  r,
rcCompactHeightfield chf,
unsigned short *  srcReg,
unsigned short *  srcDist,
rcTempVector< LevelStackEntry > &  stack 
)
static

◆ isRegionConnectedToBorder()

static bool isRegionConnectedToBorder ( const rcRegion reg)
static

◆ isSolidEdge()

static bool isSolidEdge ( rcCompactHeightfield chf,
const unsigned short *  srcReg,
int  x,
int  y,
int  i,
int  dir 
)
static

◆ mergeAndFilterLayerRegions()

static bool mergeAndFilterLayerRegions ( rcContext ctx,
int  minRegionArea,
unsigned short &  maxRegionId,
rcCompactHeightfield chf,
unsigned short *  srcReg 
)
static

◆ mergeAndFilterRegions()

static bool mergeAndFilterRegions ( rcContext ctx,
int  minRegionArea,
int  mergeRegionSize,
unsigned short &  maxRegionId,
rcCompactHeightfield chf,
unsigned short *  srcReg,
rcIntArray overlaps 
)
static

◆ mergeRegions()

static bool mergeRegions ( rcRegion rega,
rcRegion regb 
)
static

◆ paintRectRegion()

static void paintRectRegion ( int  minx,
int  maxx,
int  miny,
int  maxy,
unsigned short  regId,
rcCompactHeightfield chf,
unsigned short *  srcReg 
)
static

◆ removeAdjacentNeighbours()

static void removeAdjacentNeighbours ( rcRegion reg)
static

◆ replaceNeighbour()

static void replaceNeighbour ( rcRegion reg,
unsigned short  oldId,
unsigned short  newId 
)
static

◆ sortCellsByLevel()

static void sortCellsByLevel ( unsigned short  startLevel,
rcCompactHeightfield chf,
const unsigned short *  srcReg,
unsigned int  nbStacks,
rcTempVector< LevelStackEntry > *  stacks,
unsigned short  loglevelsPerStack 
)
static

◆ walkContour()

static void walkContour ( int  x,
int  y,
int  i,
int  dir,
rcCompactHeightfield chf,
const unsigned short *  srcReg,
rcIntArray cont 
)
static

Variable Documentation

◆ RC_NULL_NEI

const unsigned short RC_NULL_NEI = 0xffff
static