| 118 | } |
| 119 | |
| 120 | static 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; |
no test coverage detected