public static void DrawVisibilityGraph(this IDebugCanvas canvas, PolyNodeVisibilityGraph visibilityGraph) { canvas.DrawLineList( visibilityGraph.Barriers.SelectMany(barrier => barrier.Points.Select(p => new IntVector3(p))).ToList(), BarrierStrokeStyle); if (visibilityGraph.Waypoints.Any()) { canvas.DrawLineList( (from sourceIndex in Enumerable.Range(0, visibilityGraph.Waypoints.Length) let sourceWaypoint = new IntVector3(visibilityGraph.Waypoints[sourceIndex]) let offset = visibilityGraph.Offsets[sourceIndex] let end = visibilityGraph.Offsets[sourceIndex + 1] from edgeIndex in Enumerable.Range(offset, end - offset) let edge = visibilityGraph.Edges[edgeIndex] let destWaypoint = new IntVector3(visibilityGraph.Waypoints[edge.NextIndex]) select new IntLineSegment3(sourceWaypoint, destWaypoint)).ToList(), VisibilityEdgeStrokeStyle); canvas.DrawPoints( visibilityGraph.Waypoints.Select(p => new IntVector3(p)).ToList(), WaypointStrokeStyle); foreach (var(i, waypoint) in visibilityGraph.Waypoints.Enumerate()) { canvas.DrawText("" + i, waypoint); } } }
public static void DrawText(this IDebugCanvas canvas, string text, IntVector2 point) { canvas.DrawText(text, ToDV3(point)); }