Exemplo n.º 1
0
 private Mesh LoadMesh(String filename)
 {
     String extension = filename.Split('.').Last().ToLower();
     IMeshParser parser;
     if (extension.Equals("3dxml")) {
         parser = new MeshParser3DXml();
     } else if (extension.Equals("stl")) {
         parser = new MeshParserStl();
     } else {
         throw new ArgumentException("Unsupported file type: " + extension);
     }
     parser.Parse(filename);
     Mesh mesh = parser.GetMesh();
     Vector3 size = mesh.BoundingBox.Max - mesh.BoundingBox.Min;
     if (size.Length > 1000) {
         mesh = MeshUtils.Scale(mesh, 0.001f);
     }
     toolStripStatusLabel.Text = string.Format("Loaded model {0}, {1} triangles, {2:0.00}x{3:0.00}x{4:0.00}m",
         System.IO.Path.GetFileName(filename),
         mesh.triangles.Length,
         size.X, size.Y, size.Z);
     return mesh;
 }
Exemplo n.º 2
0
 private Mesh LoadMesh(String filename)
 {
     String extension = filename.Split('.').Last().ToLower();
     IMeshParser parser;
     if (extension.Equals("3dxml")) {
         parser = new MeshParser3DXml();
     } else if (extension.Equals("stl")) {
         parser = new MeshParserStl();
     } else {
         throw new ArgumentException("Unsupported file type: " + extension);
     }
     parser.Parse(filename);
     return parser.GetMesh();
 }