Пример #1
0
        protected override void OnPopulateMesh(VertexHelper vh)
        {
            vh.Clear();
            if (lastPolyShape == null)
            {
                return;
            }
            if (needGenerateMesh)
            {
                contex.Clear();
                contex.polyShape         = lastPolyShape;
                contex.mesh.defaultColor = this.color;
                nodeSet.Do(contex);
                needGenerateMesh = false;
            }

            var mesh = contex.mesh;

            for (int i = 0; i < contex.mesh.vertexes.Count; i++)
            {
                vh.AddVert(mesh.vertexes[i], mesh.GetColor(i), mesh.GetUV(i));
            }
            for (int i = 0; i < mesh.triangles.Count; i += 3)
            {
                vh.AddTriangle(mesh.triangles[i], mesh.triangles[i + 1], mesh.triangles[i + 2]);
            }
        }
Пример #2
0
 public void Draw()
 {
     if (currentShapeProvider == null)
     {
         return;
     }
     contex.Clear();
     contex.mesh.defaultColor = color;
     contex.polyShape         = currentShapeProvider.Poly;
     nodeSet.Do(contex);
     mesh.Clear();
     mesh.SetVertices(contex.mesh.vertexes);
     mesh.SetColors(contex.mesh.colors);
     mesh.SetUVs(0, contex.mesh.uv);
     mesh.SetTriangles(contex.mesh.triangles, 0);
 }