Пример #1
0
 public void ChangeShader(Shader newShader)
 {
     if(DrawShader != null)
         DrawShader.Dispose();
     DrawShader = newShader;
 }
Пример #2
0
        public DataSeries(List<GraphPoint> points, Shader shader, string name, Color? color)
        {
            if (points == null)
                points = new List<GraphPoint>();

            List<GraphPoint> idCorrection = new List<GraphPoint>();
            int count = 0;
            foreach (object obj in points)
            {
                GraphPoint newPoint = (GraphPoint)obj;
                newPoint.index = count++;
                idCorrection.Add(newPoint);
            }

            DataPoints = idCorrection;

            if (shader == null)
            {
                shader = new Shader("shaders/v_graphplot.vert", "shaders/f_graphplot.frag");
            }
            DrawShader = shader;

            Name = name;
            if (Name == null)
            {
                Name = "Series1";
                int currentIndex = 1;

                for (int i = 0; i < AllDataSeries.Count; i++)
                {
                    if (AllDataSeries[i].Name == Name)
                    {
                        i = -1;
                        Name = "Series" + (++currentIndex);
                    }
                }
            }

            if (color == null)
            {
                DrawColor = defaultColors[currentDefaultColor];
                currentDefaultColor = (currentDefaultColor + 1) % defaultColors.Length;
            }
            else
            {
                DrawColor = (Color)color;
            }

            VertexVBO = GL.GenBuffer();
            IndexVBO = GL.GenBuffer();

            AllDataSeries.Add(this);

            DrawMode = lastDrawMode;
            ColorMode = lastColorMode;
            TransparencyMode = lastTransparencyMode;
            LineWidth = lastLineWidth;
            Hidden = false;

            GL.UseProgram(DrawShader.shaderProgramHandle);
            GL.UniformMatrix4(DrawShader.uVertexOffsetLocation, false, ref pointTransform);

            UpdateVertexVBO();
            UpdateIndexVBO();
            DataSeries_Funcs.UpdateSeriesInfoInUI();

            GLGraph.self.UpdateMatrices(true);
        }
Пример #3
0
 public DataSeries(List<GraphPoint> points, Shader shader)
     : this(points, shader, null, null)
 {
 }
Пример #4
0
 public DataSeries(List<GraphPoint> points, Shader shader, string name)
     : this(points, shader, name, null)
 {
 }
Пример #5
0
        public void RecreateShaders()
        {
            axisShader = new Shader("shaders/v_graphaxis.vert", "shaders/f_graphaxis.frag");
            microAxisShader = new Shader("shaders/v_graphmicroaxis.vert", "shaders/f_graphaxis.frag");

            Redraw();
        }