示例#1
0
        void CreateStalk()
        {
            EraseData();

            PointList lastRing = null;

            for (int j = 0; j <= RowCount; ++j)
            {
                Debug.Log(string.Format("making ring at {0} with last {1}", j, lastRing));
                float     ringHeight = this.Height * j / RowCount;
                PointList pl         = PointList.MakeRing(this, ringHeight, lastRing);
                PointLists.Add(pl);
                lastRing = pl;
            }

            CreateSpine();
            SpineToPoints();

            Mesh stalk;

            GetComponent <MeshFilter> ().mesh.Clear();
            stalk = GetComponent <MeshFilter> ().mesh;


            stalk.vertices  = Vertices;
            stalk.triangles = triangles.ToArray();
            stalk.normals   = Normals;
            stalk.uv        = UVs;

#if DRAW_NORMALS
            foreach (Point p in Points)
            {
                GameObject n = (GameObject)Instantiate(NormalPointer);
                p.AlignGameObject(n);
                Pointers.Add(n);
            }
#endif
        }