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

Function drawMeshTile

3rdparty/recast/DetourDebugDraw.cpp:120–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120static void drawMeshTile(duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMeshQuery* query,
121 const dtMeshTile* tile, unsigned char flags)
122{
123 dtPolyRef base = mesh.getPolyRefBase(tile);
124
125 int tileNum = mesh.decodePolyIdTile(base);
126 const unsigned int tileColor = duIntToCol(tileNum, 128);
127
128 dd->depthMask(false);
129
130 dd->begin(DU_DRAW_TRIS);
131 for (int i = 0; i < tile->header->polyCount; ++i)
132 {
133 const dtPoly* p = &tile->polys[i];
134 if (p->getType() == DT_POLYTYPE_OFFMESH_CONNECTION) // Skip off-mesh links.
135 continue;
136
137 const dtPolyDetail* pd = &tile->detailMeshes[i];
138
139 unsigned int col;
140 if (query && query->isInClosedList(base | (dtPolyRef)i))
141 col = duRGBA(255,196,0,64);
142 else
143 {
144 if (flags & DU_DRAWNAVMESH_COLOR_TILES)
145 col = tileColor;
146 else
147 col = duTransCol(dd->areaToCol(p->getArea()), 64);
148 }
149
150 for (int j = 0; j < pd->triCount; ++j)
151 {
152 const unsigned char* t = &tile->detailTris[(pd->triBase+j)*4];
153 for (int k = 0; k < 3; ++k)
154 {
155 if (t[k] < p->vertCount)
156 dd->vertex(&tile->verts[p->verts[t[k]]*3], col);
157 else
158 dd->vertex(&tile->detailVerts[(pd->vertBase+t[k]-p->vertCount)*3], col);
159 }
160 }
161 }
162 dd->end();
163
164 // Draw inter poly boundaries
165 drawPolyBoundaries(dd, tile, duRGBA(0,48,64,32), 1.5f, true);
166
167 // Draw outer poly boundaries
168 drawPolyBoundaries(dd, tile, duRGBA(0,48,64,220), 2.5f, false);
169
170 if (flags & DU_DRAWNAVMESH_OFFMESHCONS)
171 {
172 dd->begin(DU_DRAW_LINES, 2.0f);
173 for (int i = 0; i < tile->header->polyCount; ++i)
174 {
175 const dtPoly* p = &tile->polys[i];
176 if (p->getType() != DT_POLYTYPE_OFFMESH_CONNECTION) // Skip regular polys.
177 continue;

Callers 2

duDebugDrawNavMeshFunction · 0.85

Calls 15

duIntToColFunction · 0.85
duRGBAFunction · 0.85
duTransColFunction · 0.85
drawPolyBoundariesFunction · 0.85
duDarkenColFunction · 0.85
duAppendCircleFunction · 0.85
duAppendArcFunction · 0.85
getPolyRefBaseMethod · 0.80
decodePolyIdTileMethod · 0.80
isInClosedListMethod · 0.80
areaToColMethod · 0.80
depthMaskMethod · 0.45

Tested by

no test coverage detected