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 natureType 
Mesh smooth = new Mesh(original.Vertices.Length, original.Triangles.Length, Mesh.natureType.Smooth);

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

// Converts triangles type 
for (int i = 0; i < original.Triangles.Length; i++)
{
    IndexTriangle it = original.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.LayerName = original.LayerName;
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.