// Use this for initialization void Start () { Mesh mesh = GetComponent<MeshFilter>().mesh; vertices = mesh.vertices; normals = mesh.normals; triangles = mesh.triangles; meshStruct = new MeshStructure (); for (int i = 0; i < triangles.Length - 1; i+=3) { Face f = createFace (i); meshStruct.addFace (f); } meshStruct.recalculateLabels (); highMesh = new HighLevelMesh(meshStruct); highMesh.construct (); float num = UnityEngine.Random.value; if (num < 0.5f) { ModelBlackBricks module = new ModelBlackBricks (this.transform); module.apply (highMesh); } else { ModelRedBricks module = new ModelRedBricks (this.transform); module.apply (highMesh); } }
public HighLevelMesh (MeshStructure structure) { sourceMesh = structure; // Labeled source mesh edges = new List<HighLevelEdge> (); regions = new List<Region> (); corners = new List<Corner> (); }