Exemple #1
0
        internal static void RenderHueRect(LGuiRect Rect)
        {
            var Width  = (int)Rect.Width;
            var Height = (int)Rect.Height;

            var Vertices = new LGuiVec2[Width * Height];
            var Colors   = new LGuiColor[Width * Height];
            var Indices  = new int[Width * Height * 2];
            var Index    = 0;

            for (var Y = 0; Y < Height; ++Y)
            {
                for (var X = 0; X < Width; ++X)
                {
                    Colors[Index]   = LGuiColor.Hsv2Rgb(new LGuiColor(X / (float)(Width - 1), 1, 1));
                    Vertices[Index] = new LGuiVec2(X, Y);

                    Indices[Index * 2 + 0] = Index;
                    Indices[Index * 2 + 1] = Index;
                    Index++;
                }
            }

            LGuiGraphics.DrawPrimitive(Rect, Vertices, Colors, Indices);
        }