protected void ApplyShadowZeroAlloc(FillHelper verts, Color32 color, int start, int end, float z, bool justReplace)
        {
            UIVertex uIVertex = new UIVertex();

            for (int i = start; i < end; i++)
            {
                verts.PopulateUIVertex(ref uIVertex, i);
                Vector3 position = uIVertex.position;
                position.z        = z;
                uIVertex.position = position;
                uIVertex.color    = Color.Lerp(uIVertex.color, color, m_BodyAlpha);
                if (justReplace)
                {
                    verts.SetUIVertex(uIVertex, i);
                }
                else
                {
                    verts.AddVert(uIVertex);
                    if (i % 4 == 0)
                    {
                        var t = verts.currentVertCount - 1;
                        verts.AddTriangle(t + 0, t + 1, t + 3);
                        verts.AddTriangle(t + 3, t + 1, t + 2);
                    }
                }
            }
        }
Example #2
0
        // Using this variant is much faster than anything else...
        public void Draw(int id, Vector3 vPos, Vector2 vSize, Vector2 uvTL, Vector2 uvTR, Vector2 uvBR, Vector2 uvBL)
        {
            var c = new Vector2(id, 0);
            var r = TexContext.Color.value;

            vertex.AddVert(vPos, r, uvTL, c); //Top-Left
            vPos.x += vSize.x;
            vertex.AddVert(vPos, r, uvTR, c); //Top-Right
            vPos.y += vSize.y;
            vertex.AddVert(vPos, r, uvBR, c); //Bottom-Right
            vPos.x -= vSize.x;
            vertex.AddVert(vPos, r, uvBL, c); //Bottom-Left

            vertex.AddQuad();
        }
Example #3
0
        public void Draw(int id, Rect v, Vector2[] uv)
        {
            Vector2 c = VectorCode(id);
            int     t = vertex.currentVertCount;

            //Top-Left
            vertex.AddVert(new Vector2(v.xMin, v.yMin), TexUtility.RenderColor, uv[0], Vector2.zero, c);
            //Top-Right
            vertex.AddVert(new Vector2(v.xMax, v.yMin), TexUtility.RenderColor, uv[1], Vector2.zero, c);
            //Bottom-Right
            vertex.AddVert(new Vector2(v.xMax, v.yMax), TexUtility.RenderColor, uv[2], Vector2.zero, c);
            //Bottom-Left
            vertex.AddVert(new Vector2(v.xMin, v.yMax), TexUtility.RenderColor, uv[3], Vector2.zero, c);

            vertex.AddTriangle(t + 0, t + 1, t + 2);
            vertex.AddTriangle(t + 2, t + 3, t + 0);
        }