3 using System.Collections.Generic;
20 meshes =
new List<Mesh>();
26 if(mData.
vertices.Length < vertexLimit) {
27 Debug.Log(
"Vertices size : "+vertices.Length);
28 Debug.Log(
" triangle size : "+ triangles.Length);
29 Mesh mesh =
new Mesh();
38 lastIndex = triangles.Length;
40 while(currentIndex < lastIndex) {
51 List<int> tris =
new List<int>();
52 List<Vector3> verts =
new List<Vector3>();
53 List<Vector3> norms =
new List<Vector3>();
54 List<Color32> cols =
new List<Color32>();
55 Dictionary<int, int> dict =
new Dictionary<int, int>();
56 int currentVertex = 0;
61 bool useColors = (colors != null);
65 while( roomLeft && (currentIndex < lastIndex) ) {
69 if(dict.TryGetValue(triangles[currentIndex], out index)) {
74 dict.Add(triangles[currentIndex], currentVertex);
78 verts.Add(vertices[vIndex]);
79 norms.Add(normals[vIndex]);
81 cols.Add(colors[vIndex]);
84 tris.Add(currentVertex);
89 if( (currentVertex > vertexLimit) && ( (currentIndex+1) % 3 == 0) )
98 Mesh mesh =
new Mesh();
99 mesh.vertices = verts.ToArray();
100 mesh.triangles = tris.ToArray();
101 mesh.normals = norms.ToArray();
102 mesh.colors32 = cols.ToArray();
List< Mesh > Split(MeshData mData)
!WiP Includes FLAGS of GUI.