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

Function duDebugDrawTileCacheContours

3rdparty/recast/DetourDebugDraw.cpp:648–726  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

646};*/
647
648void duDebugDrawTileCacheContours(duDebugDraw* dd, const struct dtTileCacheContourSet& lcset,
649 const float* orig, const float cs, const float ch)
650{
651 if (!dd) return;
652
653 const unsigned char a = 255;// (unsigned char)(alpha*255.0f);
654
655 const int offs[2*4] = {-1,0, 0,1, 1,0, 0,-1};
656
657 dd->begin(DU_DRAW_LINES, 2.0f);
658
659 for (int i = 0; i < lcset.nconts; ++i)
660 {
661 const dtTileCacheContour& c = lcset.conts[i];
662 unsigned int color = 0;
663
664 color = duIntToCol(i, a);
665
666 for (int j = 0; j < c.nverts; ++j)
667 {
668 const int k = (j+1) % c.nverts;
669 const unsigned char* va = &c.verts[j*4];
670 const unsigned char* vb = &c.verts[k*4];
671 const float ax = orig[0] + va[0]*cs;
672 const float ay = orig[1] + (va[1]+1+(i&1))*ch;
673 const float az = orig[2] + va[2]*cs;
674 const float bx = orig[0] + vb[0]*cs;
675 const float by = orig[1] + (vb[1]+1+(i&1))*ch;
676 const float bz = orig[2] + vb[2]*cs;
677 unsigned int col = color;
678 if ((va[3] & 0xf) != 0xf)
679 {
680 // Portal segment
681 col = duRGBA(255,255,255,128);
682 int d = va[3] & 0xf;
683
684 const float cx = (ax+bx)*0.5f;
685 const float cy = (ay+by)*0.5f;
686 const float cz = (az+bz)*0.5f;
687
688 const float dx = cx + offs[d*2+0]*2*cs;
689 const float dy = cy;
690 const float dz = cz + offs[d*2+1]*2*cs;
691
692 dd->vertex(cx,cy,cz,duRGBA(255,0,0,255));
693 dd->vertex(dx,dy,dz,duRGBA(255,0,0,255));
694 }
695
696 duAppendArrow(dd, ax,ay,az, bx,by,bz, 0.0f, cs*0.5f, col);
697 }
698 }
699 dd->end();
700
701 dd->begin(DU_DRAW_POINTS, 4.0f);
702
703 for (int i = 0; i < lcset.nconts; ++i)
704 {
705 const dtTileCacheContour& c = lcset.conts[i];

Callers

nothing calls this directly

Calls 7

duIntToColFunction · 0.85
duRGBAFunction · 0.85
duAppendArrowFunction · 0.85
duDarkenColFunction · 0.85
beginMethod · 0.45
vertexMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected