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

Function duDebugDrawTileCacheLayerRegions

3rdparty/recast/DetourDebugDraw.cpp:583–629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

581}
582
583void duDebugDrawTileCacheLayerRegions(struct duDebugDraw* dd, const dtTileCacheLayer& layer, const float cs, const float ch)
584{
585 const int w = (int)layer.header->width;
586 const int h = (int)layer.header->height;
587 const float* bmin = layer.header->bmin;
588 const float* bmax = layer.header->bmax;
589 const int idx = layer.header->tlayer;
590
591 unsigned int color = duIntToCol(idx+1, 255);
592
593 // Layer bounds
594 float lbmin[3], lbmax[3];
595 lbmin[0] = bmin[0] + layer.header->minx*cs;
596 lbmin[1] = bmin[1];
597 lbmin[2] = bmin[2] + layer.header->miny*cs;
598 lbmax[0] = bmin[0] + (layer.header->maxx+1)*cs;
599 lbmax[1] = bmax[1];
600 lbmax[2] = bmin[2] + (layer.header->maxy+1)*cs;
601 duDebugDrawBoxWire(dd, lbmin[0],lbmin[1],lbmin[2], lbmax[0],lbmax[1],lbmax[2], duTransCol(color,128), 2.0f);
602
603 // Layer height
604 dd->begin(DU_DRAW_QUADS);
605 for (int y = 0; y < h; ++y)
606 {
607 for (int x = 0; x < w; ++x)
608 {
609 const int lidx = x+y*w;
610 const int lh = (int)layer.heights[lidx];
611 if (lh == 0xff) continue;
612 const unsigned char reg = layer.regs[lidx];
613
614 unsigned int col = duLerpCol(color, duIntToCol(reg, 255), 192);
615
616 const float fx = bmin[0] + x*cs;
617 const float fy = bmin[1] + (lh+1)*ch;
618 const float fz = bmin[2] + y*cs;
619
620 dd->vertex(fx, fy, fz, col);
621 dd->vertex(fx, fy, fz+cs, col);
622 dd->vertex(fx+cs, fy, fz+cs, col);
623 dd->vertex(fx+cs, fy, fz, col);
624 }
625 }
626 dd->end();
627
628 debugDrawTileCachePortals(dd, layer, cs, ch);
629}
630
631
632

Callers

nothing calls this directly

Calls 8

duIntToColFunction · 0.85
duDebugDrawBoxWireFunction · 0.85
duTransColFunction · 0.85
duLerpColFunction · 0.85
beginMethod · 0.45
vertexMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected