Clean a Mesh

This example shows how to clean a mesh in preparation for simplification.

In the following C# procedure, the Mesh.Clean method cleans the mesh by adding another vertex where two fans of triangles originally shared the same vertex. This vertex splitting results in two new triangles being added to the polygon on either side of the line segment connecting the two new vertices.

          [C#]
          

GraphicsStream adj = null;

// Load the mesh from the specified file
Mesh pMesh = Mesh.FromFile("tiger.x", MeshFlags.Managed, device, out adj);

// perform simple cleaning operation on the mesh
Mesh pTempMesh = Mesh.Clean(CleanType.Optimization, pMesh, adj, adj);
pMesh.Dispose();
pMesh = pTempMesh;