UnityEngine.UI.RawImage.OnPopulateMesh C# (CSharp) Method

OnPopulateMesh() protected method

protected OnPopulateMesh ( VertexHelper vh ) : void
vh VertexHelper
return void
        protected override void OnPopulateMesh(VertexHelper vh)
        {
            Texture mainTexture = this.mainTexture;
            vh.Clear();
            if (mainTexture != null)
            {
                Rect pixelAdjustedRect = base.GetPixelAdjustedRect();
                Vector4 vector = new Vector4(pixelAdjustedRect.x, pixelAdjustedRect.y, pixelAdjustedRect.x + pixelAdjustedRect.width, pixelAdjustedRect.y + pixelAdjustedRect.height);
                float num = mainTexture.width * mainTexture.texelSize.x;
                float num2 = mainTexture.height * mainTexture.texelSize.y;
                Color color = this.color;
                vh.AddVert(new Vector3(vector.x, vector.y), color, new Vector2(this.m_UVRect.xMin * num, this.m_UVRect.yMin * num2));
                vh.AddVert(new Vector3(vector.x, vector.w), color, new Vector2(this.m_UVRect.xMin * num, this.m_UVRect.yMax * num2));
                vh.AddVert(new Vector3(vector.z, vector.w), color, new Vector2(this.m_UVRect.xMax * num, this.m_UVRect.yMax * num2));
                vh.AddVert(new Vector3(vector.z, vector.y), color, new Vector2(this.m_UVRect.xMax * num, this.m_UVRect.yMin * num2));
                vh.AddTriangle(0, 1, 2);
                vh.AddTriangle(2, 3, 0);
            }
        }