public void SetDividingListDF(ref bool edgeCheck, int MeshIndex) { int Side = 0; int EdgeIdx = -1; Vector3 EdgePoint = Vector3.zero; int TriangleIndex = startOuterTriangleIndex; leftSide.Add(new List <int>()); rightSide.Add(new List <int>()); List <Edge> edgeList = MultiMeshAdjacencyList.Instance.EdgeList[MeshIndex]; List <Vector3> worldVertices = MultiMeshAdjacencyList.Instance.WorldPositionVertices[MeshIndex]; startVertexIndex = worldVertices.Count; Side = Intersections.MultiMeshTriangleEdgeIntersection(ref EdgeIdx, ref EdgePoint, startVertexPosition, endVertexPosition, ref TriangleIndex, startScreenRay, endScreenRay, edgeList, worldVertices, MeshIndex); if (Side == -1) { ChatManager.Instance.GenerateMessage(" 자를 수 없는 Edge 입니다."); edgeCheck = true; return; } int TriangleCount = MultiMeshManager.Instance.Meshes[MeshIndex].triangles.Length; int NotEdgeVertex = startOuterTriangleIndex; for (int i = 0; i < 3; i++) { if (edgeList[EdgeIdx].vtx1 == edgeList[NotEdgeVertex + i].vtx2) { NotEdgeVertex = edgeList[NotEdgeVertex + i].vtx1; break; } else if (edgeList[EdgeIdx].vtx2 == edgeList[NotEdgeVertex + i].vtx1) { NotEdgeVertex = edgeList[NotEdgeVertex + i].vtx2; break; } } DivideTrianglesStartIncision(startVertexPosition, EdgePoint, startOuterTriangleIndex, NotEdgeVertex, EdgeIdx, ref TriangleCount, false, MeshIndex); while (true) { if (TriangleIndex == -1) { ChatManager.Instance.GenerateMessage(" 자를 수 없는 Edge 입니다."); edgeCheck = true; Debug.Log("error"); return; } for (int i = 0; i < 3; i++) { if (edgeList[EdgeIdx].vtx1 == edgeList[TriangleIndex + i].vtx2 && edgeList[EdgeIdx].vtx2 == edgeList[TriangleIndex + i].vtx1) { EdgeIdx = TriangleIndex + i; } } if (TriangleIndex == endOuterTriangleIndex) { DivideTrianglesEndIncision(endVertexPosition, endOuterTriangleIndex, ref TriangleCount, EdgeIdx, false, MeshIndex); endVertexIndex = startVertexIndex + newVertices.Count - 1; break; } Side = Intersections.MultiMeshTriangleEdgeIntersection(ref EdgeIdx, ref EdgePoint, startVertexPosition, endVertexPosition, ref TriangleIndex, startScreenRay, endScreenRay, edgeList, worldVertices, MeshIndex); if (Side == 2) { DivideTrianglesClockWiseIncision(EdgePoint, edgeList[EdgeIdx].tri1, ref TriangleCount, EdgeIdx, false, MeshIndex); } else if (Side == 1) { DivideTrianglesCounterClockWiseIncision(EdgePoint, edgeList[EdgeIdx].tri1, ref TriangleCount, EdgeIdx, false, MeshIndex); } else { ChatManager.Instance.GenerateMessage(" 자를 수 없는 Edge 입니다."); edgeCheck = true; return; } } trianglesCount = TriangleCount; }