236 const int w = hf.
width;
238 float tmin[3], tmax[3];
239 const float by = bmax[1] - bmin[1];
254 int y0 = (int)((tmin[2] - bmin[2])*ics);
255 int y1 = (int)((tmax[2] - bmin[2])*ics);
261 float *in = buf, *inrow = buf+7*3, *p1 = inrow+7*3, *p2 = p1+7*3;
268 for (
int y = y0;
y <= y1; ++
y)
271 const float cz = bmin[2] +
y*cs;
272 dividePoly(in, nvIn, inrow, &nvrow, p1, &nvIn, cz+cs, 2);
274 if (nvrow < 3)
continue;
277 float minX = inrow[0], maxX = inrow[0];
278 for (
int i=1; i<nvrow; ++i)
280 if (minX > inrow[i*3]) minX = inrow[i*3];
281 if (maxX < inrow[i*3]) maxX = inrow[i*3];
283 int x0 = (int)((minX - bmin[0])*ics);
284 int x1 = (int)((maxX - bmin[0])*ics);
290 for (
int x = x0;
x <= x1; ++
x)
293 const float cx = bmin[0] +
x*cs;
294 dividePoly(inrow, nv2, p1, &nv, p2, &nv2, cx+cs, 0);
296 if (nv < 3)
continue;
299 float smin = p1[1], smax = p1[1];
300 for (
int i = 1; i < nv; ++i)
302 smin =
rcMin(smin, p1[i*3+1]);
303 smax =
rcMax(smax, p1[i*3+1]);
308 if (smax < 0.0f)
continue;
309 if (smin > by)
continue;
311 if (smin < 0.0f) smin = 0;
312 if (smax > by) smax = by;
318 addSpan(hf,
x,
y, ismin, ismax, area, flagMergeThr);
int width
The width of the heightfield. (Along the x-axis in cell units.)
Definition: Recast.h:276
void rcSwap(T &a, T &b)
Definition: Recast.h:560
T rcMin(T a, T b)
Definition: Recast.h:566
void rcVmin(float *mn, const float *v)
Definition: Recast.h:657
bool overlapBounds(const float *amin, const float *amax, const float *bmin, const float *bmax)
Definition: RecastRasterization.cpp:26
static const int RC_SPAN_MAX_HEIGHT
Defines the maximum value for rcSpan::smin and rcSpan::smax.
Definition: Recast.h:248
G3D::int16 y
Definition: Vector2int16.h:38
void rcVcopy(float *dest, const float *v)
Definition: Recast.h:677
T rcClamp(T v, T mn, T mx)
Definition: Recast.h:589
static void addSpan(rcHeightfield &hf, const int x, const int y, const unsigned short smin, const unsigned short smax, const unsigned char area, const int flagMergeThr)
Definition: RecastRasterization.cpp:85
T rcMax(T a, T b)
Definition: Recast.h:572
G3D::int16 x
Definition: Vector2int16.h:37
static void dividePoly(const float *in, int nin, float *out1, int *nout1, float *out2, int *nout2, float x, int axis)
Definition: RecastRasterization.cpp:173
int height
The height of the heightfield. (Along the z-axis in cell units.)
Definition: Recast.h:277
void rcVmax(float *mx, const float *v)
Definition: Recast.h:667