Rendering a evaluator(a bezier curve or surface) and its control points.
Inheritance: PointsRenderer
Ejemplo n.º 1
0
        /// <summary>
        /// Creates a renderer that renders a evaluator(a bezier curve or surface) and its control points.
        /// </summary>
        /// <param name="controlPoints"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static BezierRenderer Create(IList <vec3> controlPoints, BezierType type)
        {
            var shaderCodes = new ShaderCode[2];

            shaderCodes[0] = new ShaderCode(ManifestResourceLoader.LoadTextFile(@"Resources\Points.vert"), ShaderType.VertexShader);
            shaderCodes[1] = new ShaderCode(ManifestResourceLoader.LoadTextFile(@"Resources\Points.frag"), ShaderType.FragmentShader);
            var map = new CSharpGL.AttributeMap();

            map.Add("in_Position", Points.strposition);
            var model    = new Points(controlPoints);
            var renderer = new BezierRenderer(controlPoints, type, model, shaderCodes, map, Points.strposition);

            renderer.ModelSize     = model.Lengths;
            renderer.WorldPosition = model.WorldPosition;
            renderer.stateList.Add(new PointSizeState(10));

            return(renderer);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a renderer that renders a evaluator(a bezier curve or surface) and its control points.
        /// </summary>
        /// <param name="controlPoints"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static BezierRenderer Create(IList<vec3> controlPoints, BezierType type)
        {
            var shaderCodes = new ShaderCode[2];
            shaderCodes[0] = new ShaderCode(ManifestResourceLoader.LoadTextFile(@"Resources\Points.vert"), ShaderType.VertexShader);
            shaderCodes[1] = new ShaderCode(ManifestResourceLoader.LoadTextFile(@"Resources\Points.frag"), ShaderType.FragmentShader);
            var map = new CSharpGL.AttributeMap();
            map.Add("in_Position", Points.strposition);
            var model = new Points(controlPoints);
            var renderer = new BezierRenderer(controlPoints, type, model, shaderCodes, map, Points.strposition);
            renderer.ModelSize = model.Lengths;
            renderer.WorldPosition = model.WorldPosition;
            renderer.stateList.Add(new PointSizeState(10));

            return renderer;
        }