示例#1
0
 void OnPostRender()
 {
     if (Splines.Length == 0)
     {
         return;
     }
     for (int s = 0; s < Splines.Length; s++)
     {
         CurvySpline spline    = Splines[s];
         Color       lineColor = (s < Colors.Length) ? Colors[s] : Color.green;
         if (spline && spline.IsInitialized)
         {
             Points = spline.GetApproximation();
             CreateLineMaterial();
             lineMaterial.SetPass(0);
             GL.Begin(GL.LINES);
             GL.Color(lineColor);
             for (int i = 1; i < Points.Length; i++)
             {
                 GL.Vertex(Points[i - 1]);
                 GL.Vertex(Points[i]);
             }
             GL.End();
         }
     }
 }
示例#2
0
    /// <summary>
    /// Builds a mesh from a spline's approximation points (2D)
    /// </summary>
    /// <param name="spline">the spline to use</param>
    /// <param name="ignoreAxis">the axis to ignore (0=x,1=y,2=z)</param>
    /// <param name="close">True to create a mesh with triangles, False to create a vertex line mesh</param>
    public static Mesh CreateSplineMesh(CurvySpline spline, int ignoreAxis, bool close)
    {
        Vector3[] verts = spline.GetApproximation();
        if (spline.Closed)
        {
            System.Array.Resize <Vector3>(ref verts, verts.Length - 1);
        }

        return(buildSplineMesh(verts, ignoreAxis, !close));
    }
示例#3
0
    /// <summary>
    /// Builds a mesh from a spline's approximation points (2D)
    /// </summary>
    /// <param name="spline">the spline to use</param>
    /// <param name="ignoreAxis">the axis to ignore (0=x,1=y,2=z)</param>
    /// <param name="close">True to create a mesh with triangles, False to create a vertex line mesh</param>
    /// <param name="msh"></param>
    public static Mesh CreateSplineMesh(CurvySpline spline, int ignoreAxis, bool close, Mesh msh = null)
    {
        Vector3[] verts = spline.GetApproximation(true);
        if (spline.Closed)
        {
            CurvySplineSegment.Resize(ref verts, verts.Length - 1);
        }

        return(buildSplineMesh(verts, ignoreAxis, !close, msh));
    }
 void OnPostRender()
 {
     if (!Spline || !Spline.IsInitialized)
     {
         return;
     }
     Vector3[] approx = Spline.GetApproximation();
     GL.Color(Color.white);
     GL.Begin(GL.LINES);
     for (int i = 0; i < approx.Length - 1; i++)
     {
         GL.Vertex(approx[i]);
         GL.Vertex(approx[i + 1]);
     }
     GL.End();
 }
        /// <summary>
        /// Builds a mesh from a spline's approximation points (2D)
        /// </summary>
        /// <param name="spline">the spline to use</param>
        /// <param name="ignoreAxis">the axis to ignore (0=x,1=y,2=z)</param>
        /// <param name="close">True to create a mesh with triangles, False to create a vertex line mesh</param>
        /// <param name="msh"></param>
        public static Mesh CreateSplineMesh(CurvySpline spline, int ignoreAxis, bool close, Mesh msh = null)
        {
            Vector3[] verts = spline.GetApproximation(true);
            if (spline.Closed)
                CurvySplineSegment.Resize(ref verts, verts.Length - 1);

            return buildSplineMesh(verts, ignoreAxis, !close, msh);
        }
示例#6
0
        public static Mesh CreateSplineMesh(CurvySpline spline, int ignoreAxis, bool close)
        {
            Vector3[] verts = spline.GetApproximation(true);
            if (spline.Closed)
                System.Array.Resize<Vector3>(ref verts, verts.Length - 1);

            return buildSplineMesh(verts, ignoreAxis, !close);
        }