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

Function drawPolyBoundaries

3rdparty/recast/DetourDebugDraw.cpp:40–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40static void drawPolyBoundaries(duDebugDraw* dd, const dtMeshTile* tile,
41 const unsigned int col, const float linew,
42 bool inner)
43{
44 static const float thr = 0.01f*0.01f;
45
46 dd->begin(DU_DRAW_LINES, linew);
47
48 for (int i = 0; i < tile->header->polyCount; ++i)
49 {
50 const dtPoly* p = &tile->polys[i];
51
52 if (p->getType() == DT_POLYTYPE_OFFMESH_CONNECTION) continue;
53
54 const dtPolyDetail* pd = &tile->detailMeshes[i];
55
56 for (int j = 0, nj = (int)p->vertCount; j < nj; ++j)
57 {
58 unsigned int c = col;
59 if (inner)
60 {
61 if (p->neis[j] == 0) continue;
62 if (p->neis[j] & DT_EXT_LINK)
63 {
64 bool con = false;
65 for (unsigned int k = p->firstLink; k != DT_NULL_LINK; k = tile->links[k].next)
66 {
67 if (tile->links[k].edge == j)
68 {
69 con = true;
70 break;
71 }
72 }
73 if (con)
74 c = duRGBA(255,255,255,48);
75 else
76 c = duRGBA(0,0,0,48);
77 }
78 else
79 c = duRGBA(0,48,64,32);
80 }
81 else
82 {
83 if (p->neis[j] != 0) continue;
84 }
85
86 const float* v0 = &tile->verts[p->verts[j]*3];
87 const float* v1 = &tile->verts[p->verts[(j+1) % nj]*3];
88
89 // Draw detail mesh edges which align with the actual poly edge.
90 // This is really slow.
91 for (int k = 0; k < pd->triCount; ++k)
92 {
93 const unsigned char* t = &tile->detailTris[(pd->triBase+k)*4];
94 const float* tv[3];
95 for (int m = 0; m < 3; ++m)
96 {
97 if (t[m] < p->vertCount)

Callers 1

drawMeshTileFunction · 0.85

Calls 7

duRGBAFunction · 0.85
dtGetDetailTriEdgeFlagsFunction · 0.85
distancePtLine2dFunction · 0.85
beginMethod · 0.45
getTypeMethod · 0.45
vertexMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected