MCPcopy Create free account
hub / github.com/axmolengine/axmol / duDebugDrawTileCacheLayerAreas

Function duDebugDrawTileCacheLayerAreas

3rdparty/recast/DetourDebugDraw.cpp:529–581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

527}
528
529void duDebugDrawTileCacheLayerAreas(struct duDebugDraw* dd, const dtTileCacheLayer& layer, const float cs, const float ch)
530{
531 const int w = (int)layer.header->width;
532 const int h = (int)layer.header->height;
533 const float* bmin = layer.header->bmin;
534 const float* bmax = layer.header->bmax;
535 const int idx = layer.header->tlayer;
536
537 unsigned int color = duIntToCol(idx+1, 255);
538
539 // Layer bounds
540 float lbmin[3], lbmax[3];
541 lbmin[0] = bmin[0] + layer.header->minx*cs;
542 lbmin[1] = bmin[1];
543 lbmin[2] = bmin[2] + layer.header->miny*cs;
544 lbmax[0] = bmin[0] + (layer.header->maxx+1)*cs;
545 lbmax[1] = bmax[1];
546 lbmax[2] = bmin[2] + (layer.header->maxy+1)*cs;
547 duDebugDrawBoxWire(dd, lbmin[0],lbmin[1],lbmin[2], lbmax[0],lbmax[1],lbmax[2], duTransCol(color,128), 2.0f);
548
549 // Layer height
550 dd->begin(DU_DRAW_QUADS);
551 for (int y = 0; y < h; ++y)
552 {
553 for (int x = 0; x < w; ++x)
554 {
555 const int lidx = x+y*w;
556 const int lh = (int)layer.heights[lidx];
557 if (lh == 0xff) continue;
558
559 const unsigned char area = layer.areas[lidx];
560 unsigned int col;
561 if (area == 63)
562 col = duLerpCol(color, duRGBA(0,192,255,64), 32);
563 else if (area == 0)
564 col = duLerpCol(color, duRGBA(0,0,0,64), 32);
565 else
566 col = duLerpCol(color, dd->areaToCol(area), 32);
567
568 const float fx = bmin[0] + x*cs;
569 const float fy = bmin[1] + (lh+1)*ch;
570 const float fz = bmin[2] + y*cs;
571
572 dd->vertex(fx, fy, fz, col);
573 dd->vertex(fx, fy, fz+cs, col);
574 dd->vertex(fx+cs, fy, fz+cs, col);
575 dd->vertex(fx+cs, fy, fz, col);
576 }
577 }
578 dd->end();
579
580 debugDrawTileCachePortals(dd, layer, cs, ch);
581}
582
583void duDebugDrawTileCacheLayerRegions(struct duDebugDraw* dd, const dtTileCacheLayer& layer, const float cs, const float ch)
584{

Callers

nothing calls this directly

Calls 10

duIntToColFunction · 0.85
duDebugDrawBoxWireFunction · 0.85
duTransColFunction · 0.85
duLerpColFunction · 0.85
duRGBAFunction · 0.85
areaToColMethod · 0.80
beginMethod · 0.45
vertexMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected