Esempio n. 1
0
    static void AddQuad(UnityEngine.UI.VertexHelper vertexHelper, Vector2 posMin, Vector2 posMax, Color32 color)
    {
        int startIndex = vertexHelper.currentVertCount;

        var v = UnityEngine.UIVertex.simpleVert;

        v.position = new Vector3(posMin.x, posMin.y, 0);
        v.color = color;
        vertexHelper.AddVert(v);

        v.position = new Vector3(posMin.x, posMax.y, 0);
        v.color = color;
        vertexHelper.AddVert(v);

        v.position = new Vector3(posMax.x, posMax.y, 0);
        v.color = color;
        vertexHelper.AddVert(v);

        v.position = new Vector3(posMax.x, posMin.y, 0);
        v.color = color;
        vertexHelper.AddVert(v);

        vertexHelper.AddTriangle(startIndex, startIndex + 1, startIndex + 2);
        vertexHelper.AddTriangle(startIndex + 2, startIndex + 3, startIndex);
    }