Exemplo n.º 1
0
        public static BasicTessellationNode Create(ObjVNF model)
        {
            var vs       = new VertexShader(renderVert, "Position_VS_in", "TexCoord_VS_in", "Normal_VS_in");
            var tc       = new TessControlShader(renderTesc);
            var te       = new TessEvaluationShader(renderTese);
            var fs       = new FragmentShader(renderFrag);
            var provider = new ShaderArray(vs, tc, te, fs);
            var map      = new AttributeMap();

            map.Add("Position_VS_in", ObjVNF.strPosition);
            map.Add("TexCoord_VS_in", ObjVNF.strTexCoord);
            map.Add("Normal_VS_in", ObjVNF.strNormal);
            var builder = new RenderMethodBuilder(provider, map);

            var node = new BasicTessellationNode(model, builder);

            node.ModelSize = model.GetSize();
            node.Initialize();

            return(node);
        }
Exemplo n.º 2
0
        public static TrianglePatchNode Create()
        {
            // model provides vertex buffer and index buffer(within an IDrawCommand).
            var model = new TrianglePatchModel();
            // vertex shader and fragment shader.
            var vs    = new VertexShader(vertexCode);
            var tc    = new TessControlShader(tessellationControlCode);
            var te    = new TessEvaluationShader(tessellationEvaluationCode);
            var fs    = new FragmentShader(fragmentCode);
            var array = new ShaderArray(vs, tc, te, fs);
            // which vertex buffer maps to which attribute in shader.
            var map = new AttributeMap();
            // help to build a render method.
            var builder = new RenderMethodBuilder(array, map, new PolygonModeSwitch(PolygonMode.Line));
            // create node.
            var node = new TrianglePatchNode(model, builder);

            // initialize node.
            node.Initialize();

            return(node);
        }