/// <summary> /// /// </summary> /// <returns></returns> public static SimpleComputeNode Create() { var model = new SimpleCompute(); RenderMethodBuilder reset, compute, render; { var cs = new CSharpGL.ComputeShader(resetCompute); var map = new AttributeMap(); var provider = new ShaderArray(cs); reset = new RenderMethodBuilder(provider, map); } { var cs = new CSharpGL.ComputeShader(computeShader); var map = new AttributeMap(); var provider = new ShaderArray(cs); compute = new RenderMethodBuilder(provider, map); } { var vs = new VertexShader(renderVert); var fs = new FragmentShader(renderFrag); var provider = new ShaderArray(vs, fs); var map = new AttributeMap(); map.Add("position", SimpleCompute.strPosition); render = new RenderMethodBuilder(provider, map); } var node = new SimpleComputeNode(model, reset, compute, render); node.Initialize(); return(node); }
public PeelingNode(vec3 size, params SceneNodeBase[] children) { this.ModelSize = size; this.query = new Query(); this.Children.AddRange(children); { var cs = new CSharpGL.ComputeShader(Shaders.engraveXComp); var provider = new ShaderArray(cs); this.engraveXComp = provider.GetShaderProgram(); } { var cs = new CSharpGL.ComputeShader(Shaders.engraveYComp); var provider = new ShaderArray(cs); this.engraveYComp = provider.GetShaderProgram(); } { var cs = new CSharpGL.ComputeShader(Shaders.engraveZComp); var provider = new ShaderArray(cs); this.engraveZComp = provider.GetShaderProgram(); } { var data = new uint[Width * Height * Depth]; this.outBuffer = data.GenVertexBuffer(VBOConfig.UInt, BufferUsage.DynamicCopy); } { this.InitializePeelingResource(vWidth, vHeight); } }
public static EdgeDetectNode Create() { RenderMethodBuilder compute, render; { var cs = new CSharpGL.ComputeShader(computeShader); var provider = new ShaderArray(cs); var map = new AttributeMap(); compute = new RenderMethodBuilder(provider, map); } { var vs = new VertexShader(vertexCode); var fs = new FragmentShader(fragmentCode); var provider = new ShaderArray(vs, fs); var map = new AttributeMap(); map.Add(inPosition, RectangleModel.strPosition); map.Add(inUV, RectangleModel.strUV); render = new RenderMethodBuilder(provider, map); } var node = new EdgeDetectNode(new RectangleModel(), RectangleModel.strPosition, compute, render); node.Initialize(); return(node); }
public static ComputeShaderNode Create() { var list = new List <Config>(); list.Add(new Config(1, height, 0)); // fuzzy list.Add(new Config(1, height, 1)); // inverseColor list.Add(new Config(width / 8, height / 8, 2)); // mosaic RenderMethodBuilder fuzzy, inverseColor, mosaic, render; { var cs = new CSharpGL.ComputeShader(fuzzyComp); var provider = new ShaderArray(cs); var map = new AttributeMap(); fuzzy = new RenderMethodBuilder(provider, map); } { var cs = new CSharpGL.ComputeShader(inverseColorComp); var provider = new ShaderArray(cs); var map = new AttributeMap(); inverseColor = new RenderMethodBuilder(provider, map); } { var cs = new CSharpGL.ComputeShader(mosaicComp); var provider = new ShaderArray(cs); var map = new AttributeMap(); mosaic = new RenderMethodBuilder(provider, map); } { var vs = new VertexShader(vertexCode); var fs = new FragmentShader(fragmentCode); var provider = new ShaderArray(vs, fs); var map = new AttributeMap(); map.Add(inPosition, RectangleModel.strPosition); map.Add(inUV, RectangleModel.strUV); render = new RenderMethodBuilder(provider, map); } var node = new ComputeShaderNode(list.ToArray(), new RectangleModel(), RectangleModel.strPosition, fuzzy, inverseColor, mosaic, render); node.Initialize(); return(node); }