public static Func <T1, T2, T3, T4, TRes> Function <T1, T2, T3, T4, TRes> ( Expression <Func <Func <T1, T2, T3, T4, TRes> > > member, Expression <Func <T1, T2, T3, T4, TRes> > func) { GlslParser.CreateFunction((member.Body as MemberExpression).Member, func); return(func.Compile()); }
public static Macro <T1, T2, T3, T4, T5, T6, TRes> Macro <T1, T2, T3, T4, T5, T6, TRes> ( Expression <Func <Macro <T1, T2, T3, T4, T5, T6, TRes> > > member, Expression <Macro <T1, T2, T3, T4, T5, T6, TRes> > macro) { GlslParser.CreateMacro((member.Body as MemberExpression).Member, macro); return(macro.Compile()); }
public static string CreateShader <T> (string version, Expression <Func <Shader <T> > > shader) { var parser = new GlslParser(); parser.DeclareVaryings(typeof(T), GlslAst.VaryingKind.Out); parser.ParseShader(shader); return(parser.BuildShaderCode()); }
public static GLShader Create <T> (ShaderType type, Expression <Func <Shader <T> > > func) { var source = GlslParser.CreateShader(func); Console.WriteLine(source); Console.WriteLine("--------------------------------------------------------------------------------"); return(new GLShader(type, source)); }
/// <summary> /// Shader creation for geometry and tesselation shaders. They return multiple results /// instead of one. /// </summary> public static GLShader CreateGeometryShader <V> (int vertexCount, int invocations, PrimitiveType inputPrimitive, PrimitiveType outputPrimitive, Expression <Func <Shader <V[]> > > func) where V : PerVertexOut, new () { var source = GlslParser.CreateGeometryShader(vertexCount, invocations, inputPrimitive, outputPrimitive, func); Console.WriteLine(source); return(new GLShader(ShaderType.GeometryShader, source)); }
public static string CreateGeometryShader <T> (string version, int vertexCount, int invocations, PrimitiveType inputPrimitive, PrimitiveType outputPrimitive, Expression <Func <Shader <T[]> > > shader) { var parser = new GlslParser(); if (invocations > 0) { parser.DeclOut("layout (invocations = {0}) in;", invocations); } parser.DeclOut("layout ({0}) in;", inputPrimitive.MapInputGSPrimitive()); parser.DeclOut("layout ({0}, max_vertices = {1}) out;", outputPrimitive.MapOutputGSPrimitive(), vertexCount); parser.DeclareVaryings(typeof(T), GlslAst.VaryingKind.Out); parser.ParseGeometryShader(shader); return(parser.BuildShaderCode()); }