private static List <IPrimitive> AddTraceDataForMesh(Mesh mesh, int totalActionCount, ref int currentAction, ref bool needToUpdateProgressReport, ReportProgressRatio reportProgress) { bool continueProcessing; List <IPrimitive> allPolys = new List <IPrimitive>(); List <Vector3> positions = new List <Vector3>(); foreach (Face face in mesh.Faces) { if (false) { MeshFaceTraceable triangle = new MeshFaceTraceable(face); allPolys.Add(triangle); } else { positions.Clear(); foreach (Vertex vertex in face.Vertices()) { positions.Add(vertex.Position); } // We should use the tessellator for this if it is greater than 3. Vector3 next = positions[1]; for (int positionIndex = 2; positionIndex < positions.Count; positionIndex++) { TriangleShape triangle = new TriangleShape(positions[0], next, positions[positionIndex], null); allPolys.Add(triangle); next = positions[positionIndex]; } } if (reportProgress != null) { if ((currentAction % 256) == 0 || needToUpdateProgressReport) { reportProgress(currentAction / (double)totalActionCount, "Creating Trace Polygons", out continueProcessing); needToUpdateProgressReport = false; } currentAction++; } } return(allPolys); }
private static List<IPrimitive> AddTraceDataForMesh(Mesh mesh, int totalActionCount, ref int currentAction, ref bool needToUpdateProgressReport, ReportProgressRatio reportProgress) { bool continueProcessing; List<IPrimitive> allPolys = new List<IPrimitive>(); List<Vector3> positions = new List<Vector3>(); foreach (Face face in mesh.Faces) { if (false) { MeshFaceTraceable triangle = new MeshFaceTraceable(face); allPolys.Add(triangle); } else { positions.Clear(); foreach (Vertex vertex in face.Vertices()) { positions.Add(vertex.Position); } // We should use the tessellator for this if it is greater than 3. Vector3 next = positions[1]; for (int positionIndex = 2; positionIndex < positions.Count; positionIndex++) { TriangleShape triangle = new TriangleShape(positions[0], next, positions[positionIndex], null); allPolys.Add(triangle); next = positions[positionIndex]; } } if (reportProgress != null) { if ((currentAction % 256) == 0 || needToUpdateProgressReport) { reportProgress(currentAction / (double)totalActionCount, "Creating Trace Polygons", out continueProcessing); needToUpdateProgressReport = false; } currentAction++; } } return allPolys; }