/// <summary> /// /// </summary> /// <param name="model"></param> /// <param name="position"></param> /// <param name="normal"></param> /// <param name="size"></param> /// <returns></returns> public static NormalNode Create(IBufferSource model, string position, string normal, vec3 size) { var builders = new RenderMethodBuilder[2]; { // render model var vs = new VertexShader(vertexShader, vPosition, vNormal); var fs = new FragmentShader(fragmentShader); var provider = new ShaderArray(vs, fs); var map = new AttributeMap(); map.Add(vPosition, position); map.Add(vNormal, normal); builders[0] = new RenderMethodBuilder(provider, map); } { // render normal var vs = new VertexShader(normalVertex, vPosition, vNormal); var gs = new GeometryShader(normalGeometry); var fs = new FragmentShader(normalFragment); var provider = new ShaderArray(vs, gs, fs); var map = new AttributeMap(); map.Add(vPosition, position); map.Add(vNormal, normal); builders[1] = new RenderMethodBuilder(provider, map); } var node = new NormalNode(model, position, builders); node.ModelSize = size; node.Initialize(); return(node); }
/// <summary> /// /// </summary> /// <param name="model"></param> /// <param name="position"></param> /// <param name="normal"></param> /// <param name="size"></param> /// <returns></returns> public static NormalNode Create(IBufferSource model, string position, string texCoord, string normal, vec3 size) { var builders = new RenderMethodBuilder[2]; { // render model var vs = new VertexShader(vertexShader); var fs = new FragmentShader(fragmentShader); var provider = new ShaderArray(vs, fs); var map = new AttributeMap(); map.Add(vPosition, position); map.Add(vTexCoord, texCoord); map.Add(vNormal, normal); builders[0] = new RenderMethodBuilder(provider, map); } { // render normal var vs = new VertexShader(normalVertex); var gs = new GeometryShader(normalGeometry); var fs = new FragmentShader(normalFragment); var provider = new ShaderArray(vs, gs, fs); var map = new AttributeMap(); map.Add(vPosition, position); map.Add(vNormal, normal); builders[1] = new RenderMethodBuilder(provider, map); } var node = new NormalNode(model, position, texCoord, builders); string folder = System.Windows.Forms.Application.StartupPath; node.TextureSource = new TextureSource(System.IO.Path.Combine(folder, @"superficie.png")); node.ModelSize = size; node.Initialize(); return(node); }