| 437 | } |
| 438 | |
| 439 | void duDebugDrawNavMeshPoly(duDebugDraw* dd, const dtNavMesh& mesh, dtPolyRef ref, const unsigned int col) |
| 440 | { |
| 441 | if (!dd) return; |
| 442 | |
| 443 | const dtMeshTile* tile = 0; |
| 444 | const dtPoly* poly = 0; |
| 445 | if (dtStatusFailed(mesh.getTileAndPolyByRef(ref, &tile, &poly))) |
| 446 | return; |
| 447 | |
| 448 | dd->depthMask(false); |
| 449 | |
| 450 | const unsigned int c = duTransCol(col, 64); |
| 451 | const unsigned int ip = (unsigned int)(poly - tile->polys); |
| 452 | |
| 453 | if (poly->getType() == DT_POLYTYPE_OFFMESH_CONNECTION) |
| 454 | { |
| 455 | dtOffMeshConnection* con = &tile->offMeshCons[ip - tile->header->offMeshBase]; |
| 456 | |
| 457 | dd->begin(DU_DRAW_LINES, 2.0f); |
| 458 | |
| 459 | // Connection arc. |
| 460 | duAppendArc(dd, con->pos[0],con->pos[1],con->pos[2], con->pos[3],con->pos[4],con->pos[5], 0.25f, |
| 461 | (con->flags & 1) ? 0.6f : 0.0f, 0.6f, c); |
| 462 | |
| 463 | dd->end(); |
| 464 | } |
| 465 | else |
| 466 | { |
| 467 | const dtPolyDetail* pd = &tile->detailMeshes[ip]; |
| 468 | |
| 469 | dd->begin(DU_DRAW_TRIS); |
| 470 | for (int i = 0; i < pd->triCount; ++i) |
| 471 | { |
| 472 | const unsigned char* t = &tile->detailTris[(pd->triBase+i)*4]; |
| 473 | for (int j = 0; j < 3; ++j) |
| 474 | { |
| 475 | if (t[j] < poly->vertCount) |
| 476 | dd->vertex(&tile->verts[poly->verts[t[j]]*3], c); |
| 477 | else |
| 478 | dd->vertex(&tile->detailVerts[(pd->vertBase+t[j]-poly->vertCount)*3], c); |
| 479 | } |
| 480 | } |
| 481 | dd->end(); |
| 482 | } |
| 483 | |
| 484 | dd->depthMask(true); |
| 485 | |
| 486 | } |
| 487 | |
| 488 | static void debugDrawTileCachePortals(struct duDebugDraw* dd, const dtTileCacheLayer& layer, const float cs, const float ch) |
| 489 | { |
no test coverage detected