Exemplo n.º 1
0
        public void Fill(Vector3[] vertices, Vector2[] uv, Color32[] colors, QuickIndices indicesType)
        {
            this.vertices = vertices;
            this.uv       = uv;
            this.colors   = colors;

            mesh.Clear();

            int vertCount = vertices.Length;

            quadCount = vertCount / 4;
            if (quadAlpha == null || quadAlpha.Length != quadCount)
            {
                quadAlpha = new byte[quadCount];
            }

            for (int i = 0; i < vertCount; i++)
            {
                Color32 col = colors[i];
                int     j   = i / 4;
                quadAlpha[j] = col.a;
                col.a        = (byte)(col.a * _alpha);
                colors[i]    = col;
            }

            int triangleCount = (vertCount >> 1) * 3;

            if (indicesType == QuickIndices.Quad)
            {
                triangles = TRIANGLES;
            }
            else if (indicesType == QuickIndices.Grid9)
            {
                triangles = TRIANGLES_9_GRID;
            }
            else
            {
                triangles = new int[triangleCount];
                int k = 0;

                for (int i = 0; i < vertCount; i += 4)
                {
                    triangles[k++] = i;
                    triangles[k++] = i + 1;
                    triangles[k++] = i + 2;

                    triangles[k++] = i + 2;
                    triangles[k++] = i + 3;
                    triangles[k++] = i;
                }
            }

            mesh.vertices  = vertices;
            mesh.uv        = uv;
            mesh.triangles = triangles;
            mesh.colors32  = colors;

            meshFilter.mesh = mesh;
        }
Exemplo n.º 2
0
        public void Fill(Vector3[] verts, Vector2[] uvs, Color color, QuickIndices indicesType)
        {
            int vertCount = verts.Length;

            Color32[] cols = new Color32[vertCount];
            for (int i = 0; i < vertCount; i++)
            {
                cols[i] = color;
            }

            Fill(verts, uvs, cols, indicesType);
        }
Exemplo n.º 3
0
        public void Fill(Vector3[] vertices, Vector2[] uv, Color32[] colors, QuickIndices indicesType)
        {
            this.vertices = vertices;
            this.uv = uv;
            this.colors = colors;

            mesh.Clear();

            int vertCount = vertices.Length;
            quadCount = vertCount / 4;
            if (quadAlpha == null || quadAlpha.Length != quadCount)
                quadAlpha = new byte[quadCount];

            for (int i = 0; i < vertCount; i++)
            {
                Color32 col = colors[i];
                int j = i / 4;
                quadAlpha[j] = col.a;
                col.a = (byte)(col.a * _alpha);
                colors[i] = col;
            }

            int triangleCount = (vertCount >> 1) * 3;

            if (indicesType == QuickIndices.Quad)
                triangles = TRIANGLES;
            else if (indicesType == QuickIndices.Grid9)
                triangles = TRIANGLES_9_GRID;
            else
            {
                triangles = new int[triangleCount];
                int k = 0;

                for (int i = 0; i < vertCount; i += 4)
                {
                    triangles[k++] = i;
                    triangles[k++] = i + 1;
                    triangles[k++] = i + 2;

                    triangles[k++] = i + 2;
                    triangles[k++] = i + 3;
                    triangles[k++] = i;
                }
            }

            mesh.vertices = vertices;
            mesh.uv = uv;
            mesh.triangles = triangles;
            mesh.colors32 = colors;

            meshFilter.mesh = mesh;
        }
Exemplo n.º 4
0
        public void Fill(Vector3[] verts, Vector2[] uvs, Color color, QuickIndices indicesType)
        {
            int vertCount = verts.Length;
            Color32[] cols = new Color32[vertCount];
            for (int i = 0; i < vertCount; i++)
                cols[i] = color;

            Fill(verts, uvs, cols, indicesType);
        }