Ejemplo n.º 1
0
        public static void Set(PositionColorUVVertex[] vertices, ref uint vertexCount, float x, float y, float w, float h, Color color, Vector2 texCoordTL, Vector2 texCoordBR, float depth)
        {
            uint ucolor = color.ToUInt();

            vertexTL.X = x;
            vertexTL.Y = y;
            vertexTL.Z = depth;
            vertexTL.Color = ucolor;
            vertexTL.U = texCoordTL.X;
            vertexTL.V = texCoordTL.Y;

            vertexTR.X = x + w;
            vertexTR.Y = y;
            vertexTR.Z = depth;
            vertexTR.Color = ucolor;
            vertexTR.U = texCoordBR.X;
            vertexTR.V = texCoordTL.Y;

            vertexBL.X = x;
            vertexBL.Y = y + h;
            vertexBL.Z = depth;
            vertexBL.Color = ucolor;
            vertexBL.U = texCoordTL.X;
            vertexBL.V = texCoordBR.Y;

            vertexBR.X = x + w;
            vertexBR.Y = y + h;
            vertexBR.Z = depth;
            vertexBR.Color = ucolor;
            vertexBR.U = texCoordBR.X;
            vertexBR.V = texCoordBR.Y;

            vertices[vertexCount++] = vertexTL;
            vertices[vertexCount++] = vertexTR;
            vertices[vertexCount++] = vertexBL;

            vertices[vertexCount++] = vertexTR;
            vertices[vertexCount++] = vertexBR;
            vertices[vertexCount++] = vertexBL;
        }
Ejemplo n.º 2
0
        // Portions Copyright (C) The MonoGame Team
        public static void Set(PositionColorUVVertex[] vertices, ref uint vertexCount, float x, float y, float dx, float dy, float w, float h, float sin, float cos, Color color, Vector2 texCoordTL, Vector2 texCoordBR, float depth)
        {
            uint ucolor = color.ToUInt();

            vertexTL.X = x + dx * cos - dy * sin;
            vertexTL.Y = y + dx * sin + dy * cos;
            vertexTL.Z = depth;
            vertexTL.Color = ucolor;
            vertexTL.U = texCoordTL.X;
            vertexTL.V = texCoordTL.Y;

            vertexTR.X = x + (dx + w) * cos - dy * sin;
            vertexTR.Y = y + (dx + w) * sin + dy * cos;
            vertexTR.Z = depth;
            vertexTR.Color = ucolor;
            vertexTR.U = texCoordBR.X;
            vertexTR.V = texCoordTL.Y;

            vertexBL.X = x + dx * cos - (dy + h) * sin;
            vertexBL.Y = y + dx * sin + (dy + h) * cos;
            vertexBL.Z = depth;
            vertexBL.Color = ucolor;
            vertexBL.U = texCoordTL.X;
            vertexBL.V = texCoordBR.Y;

            vertexBR.X = x + (dx + w) * cos - (dy + h) * sin;
            vertexBR.Y = y + (dx + w) * sin + (dy + h) * cos;
            vertexBR.Z = depth;
            vertexBR.Color = ucolor;
            vertexBR.U = texCoordBR.X;
            vertexBR.V = texCoordBR.Y;

            vertices[vertexCount++] = vertexTL;
            vertices[vertexCount++] = vertexTR;
            vertices[vertexCount++] = vertexBL;

            vertices[vertexCount++] = vertexTR;
            vertices[vertexCount++] = vertexBR;
            vertices[vertexCount++] = vertexBL;
        }