| 486 | } |
| 487 | |
| 488 | static void debugDrawTileCachePortals(struct duDebugDraw* dd, const dtTileCacheLayer& layer, const float cs, const float ch) |
| 489 | { |
| 490 | const int w = (int)layer.header->width; |
| 491 | const int h = (int)layer.header->height; |
| 492 | const float* bmin = layer.header->bmin; |
| 493 | |
| 494 | // Portals |
| 495 | unsigned int pcol = duRGBA(255,255,255,255); |
| 496 | |
| 497 | const int segs[4*4] = {0,0,0,1, 0,1,1,1, 1,1,1,0, 1,0,0,0}; |
| 498 | |
| 499 | // Layer portals |
| 500 | dd->begin(DU_DRAW_LINES, 2.0f); |
| 501 | for (int y = 0; y < h; ++y) |
| 502 | { |
| 503 | for (int x = 0; x < w; ++x) |
| 504 | { |
| 505 | const int idx = x+y*w; |
| 506 | const int lh = (int)layer.heights[idx]; |
| 507 | if (lh == 0xff) continue; |
| 508 | |
| 509 | for (int dir = 0; dir < 4; ++dir) |
| 510 | { |
| 511 | if (layer.cons[idx] & (1<<(dir+4))) |
| 512 | { |
| 513 | const int* seg = &segs[dir*4]; |
| 514 | const float ax = bmin[0] + (x+seg[0])*cs; |
| 515 | const float ay = bmin[1] + (lh+2)*ch; |
| 516 | const float az = bmin[2] + (y+seg[1])*cs; |
| 517 | const float bx = bmin[0] + (x+seg[2])*cs; |
| 518 | const float by = bmin[1] + (lh+2)*ch; |
| 519 | const float bz = bmin[2] + (y+seg[3])*cs; |
| 520 | dd->vertex(ax, ay, az, pcol); |
| 521 | dd->vertex(bx, by, bz, pcol); |
| 522 | } |
| 523 | } |
| 524 | } |
| 525 | } |
| 526 | dd->end(); |
| 527 | } |
| 528 | |
| 529 | void duDebugDrawTileCacheLayerAreas(struct duDebugDraw* dd, const dtTileCacheLayer& layer, const float cs, const float ch) |
| 530 | { |
no test coverage detected