public void DebugDraw(ref Matrix drawMatrix, MyWingedEdgeMesh mesh) { var binEnum = m_outerEdgePoints.EnumerateBins(); int i = 0; while (binEnum.MoveNext()) { int binIndex = Sandbox.Game.Gui.MyCestmirDebugInputComponent.BinIndex; if (binIndex == -1 || i == binIndex) { Vector3I position = binEnum.Current.Key; int storageIndex = binEnum.Current.Value; if (storageIndex == -1) { continue; } BoundingBoxD bb, bbTform; m_outerEdgePoints.GetLocalBinBB(ref position, out bb); bbTform.Min = Vector3D.Transform(bb.Min, drawMatrix); bbTform.Max = Vector3D.Transform(bb.Max, drawMatrix); m_outerEdgePoints.CollectStorage(storageIndex, ref m_tmpOuterEdgePointList); foreach (var point in m_tmpOuterEdgePointList) { var edge = mesh.GetEdge(point.EdgeIndex); Vector3 v1 = mesh.GetVertex(edge.Vertex1); Vector3 v2 = mesh.GetVertex(edge.Vertex2); Vector3 vc = (v1 + v2) * 0.5f; Vector3 vertex; if (point.FirstPoint) { vertex = v2 * 0.9f + vc * 0.1f; } else { vertex = v1 * 0.9f + vc * 0.1f; } Vector3D vertexTformed = vertex; vertexTformed = Vector3D.Transform(vertexTformed, drawMatrix); VRageRender.MyRenderProxy.DebugDrawSphere(vertexTformed, 0.025f, Color.Yellow, 1.0f, false); } VRageRender.MyRenderProxy.DebugDrawAABB(bbTform, Color.PowderBlue, 1.0f, 1.0f, false); } i++; } }