Пример #1
0
        private void DrawScarf(Line[] lines, float opacity)
        {
            var            c          = Utility.ColorToRGBA_LE(0xD10101, (byte)(0 * opacity));
            var            alt        = Utility.ColorToRGBA_LE(0xff6464, (byte)(0 * opacity));
            List <Vector2> altvectors = new List <Vector2>();

            for (int i = 0; i < lines.Length; i += 2)
            {
                var verts = DrawLine(lines[i].Position, lines[i].Position2, c, 2);

                if (i != 0)
                {
                    altvectors.Add(verts[0]);
                    altvectors.Add(verts[1]);
                }
                altvectors.Add(verts[2]);
                altvectors.Add(verts[3]);
            }
            for (int i = 0; i < altvectors.Count - 4; i += 4)
            {
                var verts = new RiderVertex[] {
                    RiderVertex.NoTexture(altvectors[i + 0], alt),
                    RiderVertex.NoTexture(altvectors[i + 1], alt),
                    RiderVertex.NoTexture(altvectors[i + 2], alt),
                    RiderVertex.NoTexture(altvectors[i + 3], alt)
                };
                Array.Add(verts[0]);
                Array.Add(verts[1]);
                Array.Add(verts[2]);

                Array.Add(verts[3]);
                Array.Add(verts[2]);
                Array.Add(verts[0]);
            }
        }
Пример #2
0
        private void DrawScarf(Line[] lines, float opacity)
        {
            if (scarfColors.Count == 0)
            {
                scarfColors.Add(0xffffff);
            }
            if (scarfOpacity.Count == 0)
            {
                scarfOpacity.Add((byte)0xff);
            }

            var c         = Utility.ColorToRGBA_LE(0xD10101, (byte)(255 * opacity)); //Scarf color
            var alt       = Utility.ColorToRGBA_LE(0xff6464, (byte)(255 * opacity)); //Scarf color
            var scarfPart = 0;

            List <Vector2> altvectors = new List <Vector2>();

            for (int i = 0; i < lines.Length; i += 2)
            {
                scarfPart = (((i % scarfColors.Count) + (scarfColors.Count - 1)) % scarfColors.Count);
                c         = Utility.ColorToRGBA_LE(scarfColors[scarfPart], (byte)(scarfOpacity[scarfPart] * opacity));

                var verts = DrawLine(lines[i].Position, lines[i].Position2, c, 2);

                if (i != 0)
                {
                    altvectors.Add(verts[0]);
                    altvectors.Add(verts[1]);
                }
                altvectors.Add(verts[2]);
                altvectors.Add(verts[3]);
            }
            for (int i = 0; i < altvectors.Count - 4; i += 4)
            {
                scarfPart = (i / 2 % scarfColors.Count);
                alt       = Utility.ColorToRGBA_LE(scarfColors[scarfPart], (byte)(scarfOpacity[scarfPart] * opacity));
                var verts = new RiderVertex[] {
                    RiderVertex.NoTexture(altvectors[i + 0], alt),
                    RiderVertex.NoTexture(altvectors[i + 1], alt),
                    RiderVertex.NoTexture(altvectors[i + 2], alt),
                    RiderVertex.NoTexture(altvectors[i + 3], alt)
                };
                Array.Add(verts[0]);
                Array.Add(verts[1]);
                Array.Add(verts[2]);

                Array.Add(verts[3]);
                Array.Add(verts[2]);
                Array.Add(verts[0]);
            }
        }
Пример #3
0
        private void DrawScarf(Line[] lines, float opacity)
        {
            int scarfPart;
            int currentColor;

            if (scarfColorList == null || scarfColorList.Count == 0) //If for some reason this is empty use the default LRL colors
            {
                scarfColorList = new List <Color>();
                scarfColorList.Add(Color.FromArgb((int)(255 * opacity), Color.FromArgb(0x94fbab)));
                scarfColorList.Add(Color.FromArgb((int)(127 * opacity), Color.FromArgb(0xbcfbdf)));
            }

            List <Vector2> altvectors = new List <Vector2>();

            for (int i = 0; i < lines.Length; i += 2)
            {
                scarfPart    = (i % scarfColorList.Count);
                currentColor = Utility.ColorToRGBA_LE(Color.FromArgb((int)(scarfColorList[scarfPart].A * opacity), scarfColorList[scarfPart]));
                var verts = DrawLine(lines[i].Position, lines[i].Position2, currentColor, 2);

                if (i != 0)
                {
                    altvectors.Add(verts[0]);
                    altvectors.Add(verts[1]);
                }
                altvectors.Add(verts[2]);
                altvectors.Add(verts[3]);
            }
            for (int i = 0; i < altvectors.Count - 4; i += 4)
            {
                scarfPart    = (((i + 2) / 2) % scarfColorList.Count);
                currentColor = Utility.ColorToRGBA_LE(Color.FromArgb((int)(scarfColorList[scarfPart].A * opacity), scarfColorList[scarfPart]));

                var verts = new RiderVertex[] {
                    RiderVertex.NoTexture(altvectors[i + 0], currentColor),
                    RiderVertex.NoTexture(altvectors[i + 1], currentColor),
                    RiderVertex.NoTexture(altvectors[i + 2], currentColor),
                    RiderVertex.NoTexture(altvectors[i + 3], currentColor)
                };
                Array.Add(verts[0]);
                Array.Add(verts[1]);
                Array.Add(verts[2]);

                Array.Add(verts[3]);
                Array.Add(verts[2]);
                Array.Add(verts[0]);
            }
        }
        private Vector2[] DrawLine(Vector2d p1, Vector2d p2, int color, float size)
        {
            var calc = Utility.GetThickLine(p1, p2, Angle.FromLine(p1, p2), size);
            var t = GameDrawingMatrix.ScreenCoords(calc);
            var verts = new RiderVertex[] {
                RiderVertex.NoTexture(t[0],color),
                RiderVertex.NoTexture(t[1],color),
                RiderVertex.NoTexture(t[2],color),
                RiderVertex.NoTexture(t[3],color)
            };
            Array.Add(verts[0]);
            Array.Add(verts[1]);
            Array.Add(verts[2]);

            Array.Add(verts[3]);
            Array.Add(verts[2]);
            Array.Add(verts[0]);
            return t;
        }