public static void DrawTrackLine(StandardLine line, Color color, bool drawwell, bool drawcolor)
        {
            var lv    = new AutoArray <LineVertex>(24);
            var verts = new AutoArray <GenericVertex>(30);

            if (drawcolor)
            {
                if (line is RedLine redline)
                {
                    verts.AddRange(LineAccelRenderer.GetAccelDecor(redline));
                }
                lv.AddRange(LineColorRenderer.CreateDecorationLine(line, line.Color));
            }
            lv.AddRange(
                LineRenderer.CreateTrackLine(
                    line.Start,
                    line.End,
                    line.Width * 2,
                    Utility.ColorToRGBA_LE(color)));
            if (drawwell)
            {
                verts.AddRange(WellRenderer.GetWell(line));
            }
            var vao = GetLineVAO();

            vao.Scale = Game.Track.Zoom;
            foreach (var v in lv.unsafe_array)
            {
                vao.AddVertex(v);
            }
            GameDrawingMatrix.Enter();
            using (new GLEnableCap(EnableCap.Blend))
            {
                if (verts.Count != 0)
                {
                    GenericVAO gvao = new GenericVAO();
                    foreach (var v in verts.unsafe_array)
                    {
                        gvao.AddVertex(v);
                    }
                    gvao.Draw(PrimitiveType.Triangles);
                }
                vao.Draw(PrimitiveType.Triangles);
            }
            GameDrawingMatrix.Exit();
        }
Beispiel #2
0
 public LineDecorator()
 {
     _linecolorrenderer = new LineColorRenderer();
     _lineaccelrenderer = new LineAccelRenderer();
     _wellrenderer      = new WellRenderer();
 }