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

Function duDebugDrawTileCachePolyMesh

3rdparty/recast/DetourDebugDraw.cpp:728–861  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

726}
727
728void duDebugDrawTileCachePolyMesh(duDebugDraw* dd, const struct dtTileCachePolyMesh& lmesh,
729 const float* orig, const float cs, const float ch)
730{
731 if (!dd) return;
732
733 const int nvp = lmesh.nvp;
734
735 const int offs[2*4] = {-1,0, 0,1, 1,0, 0,-1};
736
737 dd->begin(DU_DRAW_TRIS);
738
739 for (int i = 0; i < lmesh.npolys; ++i)
740 {
741 const unsigned short* p = &lmesh.polys[i*nvp*2];
742 const unsigned char area = lmesh.areas[i];
743
744 unsigned int color;
745 if (area == DT_TILECACHE_WALKABLE_AREA)
746 color = duRGBA(0,192,255,64);
747 else if (area == DT_TILECACHE_NULL_AREA)
748 color = duRGBA(0,0,0,64);
749 else
750 color = dd->areaToCol(area);
751
752 unsigned short vi[3];
753 for (int j = 2; j < nvp; ++j)
754 {
755 if (p[j] == DT_TILECACHE_NULL_IDX) break;
756 vi[0] = p[0];
757 vi[1] = p[j-1];
758 vi[2] = p[j];
759 for (int k = 0; k < 3; ++k)
760 {
761 const unsigned short* v = &lmesh.verts[vi[k]*3];
762 const float x = orig[0] + v[0]*cs;
763 const float y = orig[1] + (v[1]+1)*ch;
764 const float z = orig[2] + v[2]*cs;
765 dd->vertex(x,y,z, color);
766 }
767 }
768 }
769 dd->end();
770
771 // Draw neighbours edges
772 const unsigned int coln = duRGBA(0,48,64,32);
773 dd->begin(DU_DRAW_LINES, 1.5f);
774 for (int i = 0; i < lmesh.npolys; ++i)
775 {
776 const unsigned short* p = &lmesh.polys[i*nvp*2];
777 for (int j = 0; j < nvp; ++j)
778 {
779 if (p[j] == DT_TILECACHE_NULL_IDX) break;
780 if (p[nvp+j] & 0x8000) continue;
781 const int nj = (j+1 >= nvp || p[j+1] == DT_TILECACHE_NULL_IDX) ? 0 : j+1;
782 int vi[2] = {p[j], p[nj]};
783
784 for (int k = 0; k < 2; ++k)
785 {

Callers

nothing calls this directly

Calls 5

duRGBAFunction · 0.85
areaToColMethod · 0.80
beginMethod · 0.45
vertexMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected