Fix for Issue 129.
This commit is contained in:
parent
030974fa55
commit
1e1cf6e89e
@ -991,8 +991,7 @@ bool rcBuildDistanceField(rcContext* ctx, rcCompactHeightfield& chf)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void paintRectRegion(int minx, int maxx, int miny, int maxy,
|
static void paintRectRegion(int minx, int maxx, int miny, int maxy, unsigned short regId,
|
||||||
unsigned short regId,
|
|
||||||
rcCompactHeightfield& chf, unsigned short* srcReg)
|
rcCompactHeightfield& chf, unsigned short* srcReg)
|
||||||
{
|
{
|
||||||
const int w = chf.width;
|
const int w = chf.width;
|
||||||
@ -1050,12 +1049,16 @@ bool rcBuildRegionsMonotone(rcContext* ctx, rcCompactHeightfield& chf,
|
|||||||
|
|
||||||
|
|
||||||
// Mark border regions.
|
// Mark border regions.
|
||||||
if (borderSize)
|
if (borderSize > 0)
|
||||||
{
|
{
|
||||||
paintRectRegion(0, borderSize, 0, h, id|RC_BORDER_REG, chf, srcReg); id++;
|
// Make sure border will not overflow.
|
||||||
paintRectRegion(w-borderSize, w, 0, h, id|RC_BORDER_REG, chf, srcReg); id++;
|
const int bw = rcMin(w, borderSize);
|
||||||
paintRectRegion(0, w, 0, borderSize, id|RC_BORDER_REG, chf, srcReg); id++;
|
const int bh = rcMin(h, borderSize);
|
||||||
paintRectRegion(0, w, h-borderSize, h, id|RC_BORDER_REG, chf, srcReg); id++;
|
// Paint regions
|
||||||
|
paintRectRegion(0, bw, 0, h, id|RC_BORDER_REG, chf, srcReg); id++;
|
||||||
|
paintRectRegion(w-bw, w, 0, h, id|RC_BORDER_REG, chf, srcReg); id++;
|
||||||
|
paintRectRegion(0, w, 0, bh, id|RC_BORDER_REG, chf, srcReg); id++;
|
||||||
|
paintRectRegion(0, w, h-bh, h, id|RC_BORDER_REG, chf, srcReg); id++;
|
||||||
}
|
}
|
||||||
|
|
||||||
rcIntArray prev(256);
|
rcIntArray prev(256);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user