// Start is called before the first frame update void Start() { string path = @"D:\max.off"; string savepath = @"D:\max2.off"; List <Vector3> listVertex = new List <Vector3>(); List <int> listIndices = new List <int>(); List <int> listEdges = new List <int>(); OFFReader.ReadFile(path, out listVertex, out listIndices); OFFReader.WriteFile(savepath, listVertex, listIndices, listEdges); gameObject.AddComponent <MeshFilter>(); // Creation d'un composant MeshFilter qui peut ensuite être visualisé gameObject.AddComponent <MeshRenderer>(); gameObject.GetComponent <MeshRenderer>().material = mat; Mesh msh = new Mesh(); msh.vertices = listVertex.ToArray(); msh.triangles = listIndices.ToArray(); count = new Counter(msh); gameObject.GetComponent <MeshFilter>().mesh = msh; }
// Start is called before the first frame update void Start() { string path = @"D:\bunny.off"; OFFReader.ReadFile(path, out List <Vector3> listVertex, out List <int> listIndices); originalMesh = new Mesh(); originalMesh.vertices = listVertex.ToArray(); originalMesh.triangles = listIndices.ToArray(); gameObject.AddComponent <MeshFilter>().mesh = originalMesh; gameObject.AddComponent <MeshRenderer>(); gameObject.GetComponent <MeshRenderer>().material = material; grid = new Grid(); }