| 194 | |
| 195 | template <class T> |
| 196 | inline void xGridCheckBound(xGrid& grid, const xBound& bound, const xQCData& qcd, T cb) |
| 197 | { |
| 198 | xGridIterator it; |
| 199 | |
| 200 | xBox box; |
| 201 | xBoundGetBox(box, bound); |
| 202 | |
| 203 | F32 ex = 0.25f * grid.csizex; |
| 204 | F32 ez = 0.25f * grid.csizez; |
| 205 | box.lower.x -= ex; |
| 206 | box.lower.z -= ez; |
| 207 | box.upper.x += ex; |
| 208 | box.upper.z += ez; |
| 209 | |
| 210 | grid_index var_4C, var_50; |
| 211 | var_50 = get_grid_index(grid, box.lower.x, box.lower.z); |
| 212 | var_4C = get_grid_index(grid, box.upper.x, box.upper.z); |
| 213 | |
| 214 | xGridBound* cell = xGridIterFirstCell(&grid.other, it); |
| 215 | while (cell) |
| 216 | { |
| 217 | if (xQuickCullIsects(&qcd, &((xBound*)(cell + 1))->qcd)) |
| 218 | { |
| 219 | if (!cb(*(xEnt*)cell->data, *cell)) |
| 220 | { |
| 221 | xGridIterClose(it); |
| 222 | return; |
| 223 | } |
| 224 | } |
| 225 | cell = xGridIterNextCell(it); |
| 226 | } |
| 227 | |
| 228 | for (U16 gx = var_50.x; gx <= var_4C.x; gx++) |
| 229 | { |
| 230 | for (U16 gz = var_50.z; gz <= var_4C.z; gz++) |
| 231 | { |
| 232 | xGridBound* cell = xGridIterFirstCell(&grid, gx, gz, it); |
| 233 | while (cell) |
| 234 | { |
| 235 | if (xQuickCullIsects(&qcd, &((xBound*)(cell + 1))->qcd)) |
| 236 | { |
| 237 | if (!cb(*(xEnt*)cell->data, *cell)) |
| 238 | { |
| 239 | xGridIterClose(it); |
| 240 | return; |
| 241 | } |
| 242 | } |
| 243 | cell = xGridIterNextCell(it); |
| 244 | } |
| 245 | } |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | #endif |
no test coverage detected