public void EmitFunctionHeader(StandardFunction func)
        {
            var plist = String.Join(", ", func.Params.Select(par =>
                                                             $"{par.Access.ToString().ToLower()} {par.Type.ToGLSLKeyword()} {par.Name}"
                                                             ));

            if (plist.Length == 0)
            {
                plist = "void";
            }

            _funcSource.AppendLine($"{func.ReturnType.ToGLSLKeyword()} {func.OutputName}({plist})");
        }
Exemplo n.º 2
0
        public StandardFunction AddFunction(SSLParser.StandardFunctionContext ctx, SSLVisitor vis)
        {
            var func = StandardFunction.FromContext(ctx, vis);

            var pre = FindFunction(func.Name);

            if (pre != null)
            {
                vis.Error(ctx, $"A function with the name '{func.Name}' already exists in the shader.");
            }

            _functions.Add(func.Name, func);
            return(func);
        }