MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / DebugDraw

Method DebugDraw

Source/Engine/Navigation/NavMeshRuntime.cpp:592–634  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

590}
591
592void NavMeshRuntime::DebugDraw()
593{
594 ScopeLock lock(Locker);
595 const dtNavMesh* dtNavMesh = GetNavMesh();
596 const int tilesCount = dtNavMesh ? dtNavMesh->getMaxTiles() : 0;
597 if (tilesCount == 0)
598 return;
599 Matrix worldToNavMesh, navMeshToWorld;
600 Matrix::RotationQuaternion(Properties.Rotation, worldToNavMesh);
601 Matrix::Invert(worldToNavMesh, navMeshToWorld);
602
603 for (int tileIndex = 0; tileIndex < tilesCount; tileIndex++)
604 {
605 const dtMeshTile* tile = dtNavMesh->getTile(tileIndex);
606 if (!tile->header)
607 continue;
608
609#if 0
610 // Debug draw tile bounds and owner scene name
611 BoundingBox tileBounds = *(BoundingBox*)&tile->header->bmin[0];
612 DebugDraw::DrawWireBox(tileBounds, Color::CadetBlue);
613 // TODO: build map from tile coords to tile data to avoid this loop
614 for (const auto& e : _tiles)
615 {
616 if (e.X == tile->header->x && e.Y == tile->header->y && e.Layer == tile->header->layer)
617 {
618 if (e.NavMesh && e.NavMesh->GetScene())
619 DebugDraw::DrawText(e.NavMesh->GetScene()->GetName(), tileBounds.Minimum + tileBounds.GetSize() * Float3(0.5f, 0.8f, 0.5f), Color::CadetBlue);
620 break;
621 }
622 }
623#endif
624
625 for (int i = 0; i < tile->header->polyCount; i++)
626 {
627 const dtPoly* poly = &tile->polys[i];
628 if (poly->getType() != DT_POLYTYPE_GROUND)
629 continue;
630
631 DrawPoly(this, navMeshToWorld, *tile, *poly);
632 }
633 }
634}
635
636#endif
637

Callers 1

DrawNavMeshMethod · 0.45

Calls 11

GetNavMeshFunction · 0.85
RotationQuaternionFunction · 0.85
Float3Class · 0.85
DrawPolyFunction · 0.85
getMaxTilesMethod · 0.80
GetSceneMethod · 0.80
InvertFunction · 0.50
getTileMethod · 0.45
GetNameMethod · 0.45
GetSizeMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected