UnityEngine.CanvasRenderer.SetVertices C# (CSharp) Method

SetVertices() private method

private SetVertices ( UIVertex vertices, int size ) : void
vertices UIVertex
size int
return void
        public void SetVertices(UIVertex[] vertices, int size)
        {
            Mesh mesh = new Mesh();
            List<Vector3> inVertices = new List<Vector3>();
            List<Color32> inColors = new List<Color32>();
            List<Vector2> uvs = new List<Vector2>();
            List<Vector2> list4 = new List<Vector2>();
            List<Vector3> inNormals = new List<Vector3>();
            List<Vector4> inTangents = new List<Vector4>();
            List<int> list7 = new List<int>();
            for (int i = 0; i < size; i += 4)
            {
                for (int j = 0; j < 4; j++)
                {
                    inVertices.Add(vertices[i + j].position);
                    inColors.Add(vertices[i + j].color);
                    uvs.Add(vertices[i + j].uv0);
                    list4.Add(vertices[i + j].uv1);
                    inNormals.Add(vertices[i + j].normal);
                    inTangents.Add(vertices[i + j].tangent);
                }
                list7.Add(i);
                list7.Add(i + 1);
                list7.Add(i + 2);
                list7.Add(i + 2);
                list7.Add(i + 3);
                list7.Add(i);
            }
            mesh.SetVertices(inVertices);
            mesh.SetColors(inColors);
            mesh.SetNormals(inNormals);
            mesh.SetTangents(inTangents);
            mesh.SetUVs(0, uvs);
            mesh.SetUVs(1, list4);
            mesh.SetIndices(list7.ToArray(), MeshTopology.Triangles, 0);
            this.SetMesh(mesh);
            UnityEngine.Object.DestroyImmediate(mesh);
        }

Same methods

CanvasRenderer::SetVertices ( List vertices ) : void

Usage Example

コード例 #1
0
 static public int SetVertices(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 2)
         {
             UnityEngine.CanvasRenderer self = (UnityEngine.CanvasRenderer)checkSelf(l);
             System.Collections.Generic.List <UnityEngine.UIVertex> a1;
             checkType(l, 2, out a1);
             self.SetVertices(a1);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 3)
         {
             UnityEngine.CanvasRenderer self = (UnityEngine.CanvasRenderer)checkSelf(l);
             UnityEngine.UIVertex[]     a1;
             checkType(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             self.SetVertices(a1, a2);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
All Usage Examples Of UnityEngine.CanvasRenderer::SetVertices