Ejemplo n.º 1
0
        private void CreateSegmentLine(int pieces, int segments)
        {
            mesh.Clear();
            vertices.Clear();
            triangles.Clear();
            uv.Clear();

            for (int p = 0; p < pieces; p++)
            {
                cacheMeshInfo = CreateIndividualSegment(p, segments);

                vertices.AddRange(cacheMeshInfo.vertices);
                triangles.AddRange(cacheMeshInfo.triangles);
            }

            int vLength = vertices.Count;

            for (int i = 0; i < vLength; i++)
            {
                uv.Add(NVector3To2(vertices[i]));
            }

            mesh.SetVertices(vertices);
            mesh.SetTriangles(triangles, 0);
            mesh.SetUVs(0, uv);

            mesh.RecalculateNormals();
        }
Ejemplo n.º 2
0
        private void Awake()
        {
            mesh             = new Mesh();
            _MeshFilter.mesh = mesh;
            cacheMeshInfo    = new Types.MeshInfo();

            vertices  = new List <Vector3>();
            triangles = new List <int>();
            uv        = new List <Vector2>();

            procedural_vertices  = new List <Vector3>();
            procedural_triangles = new List <int>();
            procedural_uv        = new List <Vector2>();
        }