Beispiel #1
0
        public override string VisitInclude(ShaderInputsParser.IncludeContext context)
        {
            string filename = context.FILEPATH().GetText();
            string filepath = Program.InputDir + "/" + filename;

            if (!File.Exists(filepath))
            {
                throw new Exception("Include file " + filepath + " doesn't exist");
            }

            string includeContent = File.ReadAllText(filepath);

            ShaderInputsParser parser = Program.InitializeAntlr(includeContent);

            ShaderInputsParser.InputFileContext ictx = parser.inputFile();

            ShaderInputsVisitor visitor = new ShaderInputsVisitor(m_globalCtx);

            visitor.Visit(ictx);

            OutputContext.Merge(visitor.OutputContext);

            return(base.VisitInclude(context));
        }