| 343 | } |
| 344 | |
| 345 | void xGridCheckPosition(xGrid* grid, xVec3* pos, xQCData* qcd, xGridCheckPositionCallback hitCB, |
| 346 | void* cbdata) |
| 347 | { |
| 348 | xGridIterator it; |
| 349 | S32 px, pz; |
| 350 | xGridBound* cell; |
| 351 | |
| 352 | cell = xGridIterFirstCell(grid, pos->x, pos->y, pos->z, px, pz, it); |
| 353 | while (cell) |
| 354 | { |
| 355 | xBound* cellbound = (xBound*)(cell + 1); |
| 356 | if (xQuickCullIsects(qcd, &cellbound->qcd) && !hitCB((xEnt*)cell->data, cbdata)) |
| 357 | { |
| 358 | xGridIterClose(it); |
| 359 | return; |
| 360 | } |
| 361 | cell = xGridIterNextCell(it); |
| 362 | } |
| 363 | |
| 364 | xBox clbox; |
| 365 | clbox.lower.x = grid->csizex * px; |
| 366 | clbox.lower.z = grid->csizez * pz; |
| 367 | clbox.lower.x += grid->minx; |
| 368 | clbox.lower.z += grid->minz; |
| 369 | |
| 370 | F32 clcenterx = 0.5f * grid->csizex; |
| 371 | clcenterx += clbox.lower.x; |
| 372 | |
| 373 | F32 clcenterz = 0.5f * grid->csizez; |
| 374 | clcenterz += clbox.lower.z; |
| 375 | |
| 376 | static S32 offs[4][3][2] = { -1, 0, -1, -1, 0, -1, 0, -1, 1, -1, 1, 0, |
| 377 | 1, 0, 1, 1, 0, 1, 0, 1, -1, 1, -1, 0 }; |
| 378 | |
| 379 | static S32 k; |
| 380 | |
| 381 | if (pos->x < clcenterx) |
| 382 | { |
| 383 | if (pos->z < clcenterz) |
| 384 | { |
| 385 | k = 0; |
| 386 | } |
| 387 | else |
| 388 | { |
| 389 | k = 1; |
| 390 | } |
| 391 | } |
| 392 | else |
| 393 | { |
| 394 | if (pos->z < clcenterz) |
| 395 | { |
| 396 | k = 3; |
| 397 | } |
| 398 | else |
| 399 | { |
| 400 | k = 2; |
| 401 | } |
| 402 | } |
no test coverage detected