Example #1
0
        public DataLine(GraphLines parent, Guid id, int index)
        {
            ID           = id;
            Index        = index;
            LinePoints   = new Vector3[parent.PointsInLine];
            UnscaledData = new float[LinePoints.Length];

            int vectorCapacity;

            if (parent.UseSplineGraph)
            {
                int segmentFactor = parent.SplineSegmentFactor;

                if (segmentFactor < 1)
                {
                    segmentFactor = 1;
                }

                m_segmentCount = LinePoints.Length * segmentFactor;
                vectorCapacity = m_segmentCount + 1;
            }
            else
            {
                vectorCapacity = LinePoints.Length;
            }

            m_vector = new VectorLine($"DataLine{index}", new List <Vector3>(vectorCapacity), parent.LineMaterial, parent.LineWidth, parent.GraphPoints ? LineType.Points : LineType.Continuous)
            {
                color         = parent.LineColors[index % parent.LineColors.Length],
                drawTransform = parent.Target
            };

            m_vector.Draw3DAuto();

            float zOffset = -((index + 1) * parent.LineDepthOffset + 0.05F);

            for (int x = 0; x < LinePoints.Length; x++)
            {
                UnscaledData[x] = float.NaN;
                LinePoints[x]   = new Vector3(Mathf.Lerp(-5.0F, 5.0F, x / (float)LinePoints.Length), zOffset, 0.0F); // y and z axes intentionally transposed
            }

            m_parent = parent;
        }
Example #2
0
 public DataSubscriber(GraphLines parent) => m_parent = parent;