void InitBuffer()
        {
            if (buffers.Count != shapes.Count)
            {
                buffers.Clear();

                int index = 0;

                foreach (List <Vector3d> shape in shapes)
                {
                    TimeSeriesLineVertexBuffer buffer = new TimeSeriesLineVertexBuffer(shape.Count);

                    TimeSeriesLineVertex[] pointList = (TimeSeriesLineVertex[])buffer.Lock(); // Lock the buffer (which will return our structs)

                    buffers.Add(buffer);
                    bufferCounts.Add(shape.Count);
                    int counter = 0;
                    foreach (Vector3d point in shape)
                    {
                        pointList[counter]          = new TimeSeriesLineVertex();
                        pointList[counter].Position = point;
                        pointList[counter].Tu       = (float)dates[index].StartDate;
                        pointList[counter].Tv       = (float)dates[index].EndDate;
                        pointList[counter].Color    = colors[index];
                        counter++;
                    }
                    index++;
                    if (buffer != null)
                    {
                        buffer.Unlock();
                    }
                }
            }
        }
示例#2
0
        void InitTriangleBuffer()
        {
            if (triangleBuffers.Count == 0)
            {
                int count = trianglePoints.Count;

                TimeSeriesLineVertexBuffer triangleBuffer = null;

                TimeSeriesLineVertex[] triPointList = null;
                int countLeft = count;
                int index     = 0;
                int counter   = 0;
                foreach (Vector3d point in trianglePoints)
                {
                    if (counter >= 90000 || triangleBuffer == null)
                    {
                        if (triangleBuffer != null)
                        {
                            triangleBuffer.Unlock();
                        }
                        int thisCount = Math.Min(90000, countLeft);

                        countLeft     -= thisCount;
                        triangleBuffer = new TimeSeriesLineVertexBuffer(thisCount);

                        triangleBuffers.Add(triangleBuffer);
                        triangleBufferCounts.Add(thisCount);
                        triPointList = (TimeSeriesLineVertex[])triangleBuffer.Lock(); // Lock the buffer (which will return our structs)
                        counter      = 0;
                    }

                    triPointList[counter]          = new TimeSeriesLineVertex();
                    triPointList[counter].Position = point;
                    triPointList[counter].Normal   = point;
                    int div3 = (int)(index / 3);

                    triPointList[counter].Color = triangleColors[div3];
                    triPointList[counter].Tu    = (float)triangleDates[div3].StartDate;
                    triPointList[counter].Tv    = (float)triangleDates[div3].EndDate;
                    index++;
                    counter++;
                }
                if (triangleBuffer != null)
                {
                    triangleBuffer.Unlock();
                }

                triangleColors.Clear();
                triangleDates.Clear();
                trianglePoints.Clear();

                dataToDraw = true;
            }
        }
示例#3
0
        public static TimeSeriesLineVertex Create(Vector3d position, Vector3d normal, float time, Color color)
        {
            TimeSeriesLineVertex temp = new TimeSeriesLineVertex();

            temp.Position = position;
            temp.Normal   = normal;
            temp.Tu       = time;
            temp.Tv       = 0;
            temp.color    = color;

            return(temp);
        }
示例#4
0
        void InitLineBuffer()
        {
            if (lineBuffers.Count == 0)
            {
                int count = linePoints.Count;

                TimeSeriesLineVertexBuffer lineBuffer = null;


                TimeSeriesLineVertex[] linePointList = null;
                //localCenter = new Vector3d();
                //if (DepthBuffered)
                //{
                //    // compute the local center..
                //    foreach (Vector3d point in linePoints)
                //    {
                //        localCenter.Add(point);

                //    }
                //    localCenter.X /= count;
                //    localCenter.Y /= count;
                //    localCenter.Z /= count;
                //}

                int      countLeft = count;
                int      index     = 0;
                int      counter   = 0;
                Vector3d temp;

                foreach (Vector3d point in linePoints)
                {
                    if (counter >= 100000 || linePointList == null)
                    {
                        if (lineBuffer != null)
                        {
                            lineBuffer.Unlock();
                        }
                        int thisCount = Math.Min(100000, countLeft);

                        countLeft -= thisCount;
                        lineBuffer = new TimeSeriesLineVertexBuffer(thisCount);

                        linePointList = (TimeSeriesLineVertex[])lineBuffer.Lock(); // Lock the buffer (which will return our structs)

                        lineBuffers.Add(lineBuffer);
                        lineBufferCounts.Add(thisCount);
                        counter = 0;
                    }
                    int div2 = (int)(index / 2);

                    temp = point; // -localCenter;
                    linePointList[counter]          = new TimeSeriesLineVertex();
                    linePointList[counter].Position = temp;
                    linePointList[counter].Normal   = point;
                    linePointList[counter].Tu       = (float)lineDates[div2].StartDate;
                    linePointList[counter].Tv       = (float)lineDates[div2].EndDate;
                    linePointList[counter].Color    = lineColors[div2];
                    index++;
                    counter++;
                }

                if (lineBuffer != null)
                {
                    lineBuffer.Unlock();
                }
            }
        }
示例#5
0
        void InitTriangleBuffer()
        {
            if (triangleBuffers.Count == 0)
            {
                int count = trianglePoints.Count;

                TimeSeriesLineVertexBuffer triangleBuffer = null;

                TimeSeriesLineVertex[] triPointList = null;
                int countLeft = count;
                int index = 0;
                int counter = 0;
                foreach (Vector3d point in trianglePoints)
                {
                    if (counter >= 90000 || triangleBuffer == null)
                    {
                        if (triangleBuffer != null)
                        {
                            triangleBuffer.Unlock();
                        }
                        int thisCount = Math.Min(90000, countLeft);

                        countLeft -= thisCount;
                        triangleBuffer = new TimeSeriesLineVertexBuffer(thisCount);

                        triangleBuffers.Add(triangleBuffer);
                        triangleBufferCounts.Add(thisCount);
                        triPointList = (TimeSeriesLineVertex[])triangleBuffer.Lock(); // Lock the buffer (which will return our structs)
                        counter = 0;
                    }

                    triPointList[counter] = new TimeSeriesLineVertex();
                    triPointList[counter].Position = point;
                    triPointList[counter].Normal = point;
                    int div3 = (int)(index / 3);

                    triPointList[counter].Color = triangleColors[div3];
                    triPointList[counter].Tu = (float)triangleDates[div3].StartDate;
                    triPointList[counter].Tv = (float)triangleDates[div3].EndDate;
                    index++;
                    counter++;
                }
                if (triangleBuffer != null)
                {
                    triangleBuffer.Unlock();
                }

                triangleColors.Clear();
                triangleDates.Clear();
                trianglePoints.Clear();

                dataToDraw = true;
            }
        }
示例#6
0
        public static TimeSeriesLineVertex Create(Vector3d position, Vector3d normal, float time, Color color)
        {
            TimeSeriesLineVertex temp = new TimeSeriesLineVertex();

            temp.Position = position;
            temp.Normal = normal;
            temp.Tu = time;
            temp.Tv = 0;
            temp.color = color;

            return temp;
        }
示例#7
0
        void InitLineBuffer()
        {
            if (lineBuffers.Count == 0)
            {
                int count = linePoints.Count;

                TimeSeriesLineVertexBuffer lineBuffer = null;

                TimeSeriesLineVertex[] linePointList = null;
                //localCenter = new Vector3d();
                //if (DepthBuffered)
                //{
                //    // compute the local center..
                //    foreach (Vector3d point in linePoints)
                //    {
                //        localCenter.Add(point);

                //    }
                //    localCenter.X /= count;
                //    localCenter.Y /= count;
                //    localCenter.Z /= count;
                //}

                int countLeft = count;
                int index = 0;
                int counter = 0;
                Vector3d temp;

                foreach (Vector3d point in linePoints)
                {
                    if (counter >= 100000 || linePointList == null)
                    {
                        if (lineBuffer != null)
                        {
                            lineBuffer.Unlock();
                        }
                        int thisCount = Math.Min(100000, countLeft);

                        countLeft -= thisCount;
                        lineBuffer = new TimeSeriesLineVertexBuffer(thisCount);

                        linePointList = (TimeSeriesLineVertex[])lineBuffer.Lock(); // Lock the buffer (which will return our structs)

                        lineBuffers.Add(lineBuffer);
                        lineBufferCounts.Add(thisCount);
                        counter = 0;
                    }
                    int div2 = (int)(index / 2);

                    temp = point; // -localCenter;
                    linePointList[counter] = new TimeSeriesLineVertex();
                    linePointList[counter].Position = temp;
                    linePointList[counter].Normal = point;
                    linePointList[counter].Tu = (float)lineDates[div2].StartDate;
                    linePointList[counter].Tv = (float)lineDates[div2].EndDate;
                    linePointList[counter].Color = lineColors[div2];
                    index++;
                    counter++;
                }

                if (lineBuffer != null)
                {
                    lineBuffer.Unlock();
                }

            }
        }