/// <summary> /// Draw Lines from all source vertices to all destination vertices /// as long as the number of lines to draw is smaller than maxLinesToDraw. /// </summary> /// <param name="workSpace"></param> public static void PaintLines(VLWorkSpace workSpace) { if (workSpace == null || workSpace.sourceGeometry == null || workSpace.destinationGeometry == null || workSpace.sourceGeometry.currentMesh == null) { return; } Vector3[] destinationVertices = workSpace.GetDestinationVertices(); if (workSpace.sourceGeometry.currentMesh.Length * destinationVertices.Length > maxLinesToDraw) { return; } foreach (Vector3 sourcePos in workSpace.sourceGeometry.currentMesh) { foreach (Vector3 targetPos in destinationVertices) { Handles.DrawDottedLine( workSpace.sourceGeometry.transform.TransformPoint(sourcePos), workSpace.destinationGeometry.transform.TransformPoint(targetPos), 7f); } } }
private static void DrawGizmos(VLWorkSpace workSpace, GizmoType gizmoType) { if (workSpace.sourceGeometry != null && workSpace.sourceGeometry.currentMesh != null) { VLGeometryEditor.PaintVertices( workSpace.sourceGeometry.currentMesh, Color.white, workSpace.sourceGeometry.transform); } if (workSpace.displayViewDirection) { PaintLines(workSpace); } if (workSpace.destinationGeometry != null) { Vector3[] destinationVertices = workSpace.GetDestinationVertices(); Handles.Label(destinationVertices[0], "Target"); VLGeometryEditor.PaintVertices( destinationVertices, Color.cyan, workSpace.destinationGeometry.transform); } SceneView.RepaintAll(); }