public static void DrawPoints(this IDebugCanvas canvas, IReadOnlyList <DoubleVector3> points, StrokeStyle strokeStyle) { canvas.BatchDraw(() => { foreach (var point in points) { canvas.DrawPoint(point, strokeStyle); } }); }
private void DrawEntities(IDebugCanvas debugCanvas) { foreach (var(i, entity) in EntityService.EnumerateEntities().Enumerate()) { // if (i == 2 || i == 1) continue; var movementComponent = entity.MovementComponent; if (movementComponent != null) { debugCanvas.Transform = Matrix4x4.Identity; debugCanvas.DrawPoint(movementComponent.WorldPosition, new StrokeStyle(Color.Black, 2 * movementComponent.BaseRadius)); debugCanvas.DrawPoint(movementComponent.WorldPosition, new StrokeStyle(Color.White, 2 * movementComponent.BaseRadius - 2)); // if (movementComponent.Swarm != null && movementComponent.WeightedSumNBodyForces.Norm2D() > GeometryOperations.kEpsilon) { // var direction = movementComponent.WeightedSumNBodyForces.ToUnit() * movementComponent.BaseRadius; // var to = movementComponent.WorldPosition + new DoubleVector3(direction.X, direction.Y, 0.0); // debugCanvas.DrawLine(movementComponent.WorldPosition, to, new StrokeStyle(Color.Gray)); // } //if (movementComponent.DebugLines != null) // debugCanvas.DrawLineList( // movementComponent.DebugLines.SelectMany(pair => new[] { pair.Item1, pair.Item2 }).ToList(), // new StrokeStyle(Color.Black)); continue; var terrainOverlayNetwork = TerrainService.CompileSnapshot().OverlayNetworkManager.CompileTerrainOverlayNetwork(entity.MovementComponent.BaseRadius); if (terrainOverlayNetwork.TryFindTerrainOverlayNode(movementComponent.WorldPosition, out var node, out var plocal)) { debugCanvas.Transform = node.SectorNodeDescription.WorldTransform; //debugCanvas.DrawTriangulation(node.LocalGeometryView.Triangulation, StrokeStyle.BlackHairLineSolid); if (node.LocalGeometryView.Triangulation.TryIntersect(plocal.X, plocal.Y, out var island, out var triangleIndex)) { debugCanvas.DrawTriangle(island.Triangles[triangleIndex], StrokeStyle.RedHairLineSolid); } } } } }
public static void DrawPoint(this IDebugCanvas canvas, DoubleVector2 p, StrokeStyle strokeStyle) { canvas.DrawPoint(ToDV3(p), strokeStyle); }