INNER CODE UNIT · C
d
xonotic/darkplaces · bih.c:103
d = (child->mins[axis] + child->maxs[axis]) * 0.5f;
if (d < splitdist)
bih->leafsortscratch[back++] = leaflist[i];
else
leaflist[front++] = leaflist[i];
}
// now copy the back ones into the space made in the leaflist for them
if (back)
memcpy(leaflist + front, bih->leafsortscratch, back*sizeof(leaflist[0]));
// if both sides have some children, it's good enough for us.
if (front && back)
break;
}
if (j == 3)
{
// somewhat common case: no good choice, divide children arbitrarily
axis = 0;
back = numchildren >> 1;