Ejemplo n.º 1
0
        private void AddQuad(VertexElement rVertexElement, Vector2 rPosMin, Vector2 rPosMax, Color32 rColor, Vector2 rUvMin, Vector2 rUvMax)
        {
            int nStartIndex = rVertexElement.Vertices.Count;

            rVertexElement.AddVert(new Vector3(rPosMin.x, rPosMin.y, 0), rColor, new Vector2(rUvMin.x, rUvMin.y));
            rVertexElement.AddVert(new Vector3(rPosMin.x, rPosMax.y, 0), rColor, new Vector2(rUvMin.x, rUvMax.y));
            rVertexElement.AddVert(new Vector3(rPosMax.x, rPosMax.y, 0), rColor, new Vector2(rUvMax.x, rUvMax.y));
            rVertexElement.AddVert(new Vector3(rPosMax.x, rPosMin.y, 0), rColor, new Vector2(rUvMax.x, rUvMin.y));

            rVertexElement.AddTriangle(nStartIndex, nStartIndex + 1, nStartIndex + 2);
            rVertexElement.AddTriangle(nStartIndex + 2, nStartIndex + 3, nStartIndex);
        }
Ejemplo n.º 2
0
        private void AddQuad(VertexElement rVertexElement, Vector3[] rQuadPositions, Color32 rColor, Vector3[] rQuadUVs)
        {
            int startIndex = rVertexElement.Vertices.Count;

            for (int i = 0; i < 4; ++i)
            {
                rVertexElement.AddVert(rQuadPositions[i], rColor, rQuadUVs[i]);
            }

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