Converting a plain Mesh to smooth

It sometimes happens that imported Meshes have Plain meshNature and look faceted. The following code snippet demonstrates how to convert them to new smooth Mesh entities.

// Creates a new Mesh with Smooth meshNature 
Mesh smooth = new Mesh(original.Vertices.Length, original.Triangles.Length, meshNatureType.Smooth); 

// Assigns original vertices to smooth one 
smooth.Vertices = m.Vertices; 

// Converts triangles type 
for (int i = 0; i < m.Triangles.Length; i++) 
   IndexTriangle it = m.Triangles[i]; 
   smooth.Triangles[i] = new SmoothTriangle(it.V1, it.V2, it.V3); 

// copies some attributes                     
smooth.Color = original.Color; 
smooth.ColorMethod = original.ColorMethod; 
smooth.LayerIndex = original.LayerIndex;
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request



Please sign in to leave a comment.