コード例 #1
0
        protected override CodeFile CreateCodeFile(string id, string name)
        {
            var result = new CodeFileGlsl(id, name);

            result.ShaderFile = ShaderFile.CreateEmpty();
            return(result);
        }
コード例 #2
0
        public static void CloneContent(CodeFileGlsl source, CodeFileGlsl target, IMetadataRecorder metadataRecorder)
        {
            if (source.ShaderFile != null)
            {
                CloningAstVisitor cloner = new CloningAstVisitor();
                if (target.ShaderFile == null)
                {
                    target.ShaderFile = ShaderFile.CreateEmpty(source.ShaderFile.SyntaxTree.Version);
                }

                target.ShaderFile.SyntaxTree.Version = source.ShaderFile.SyntaxTree.Version;
                foreach (var declaration in source.ShaderFile.SyntaxTree.Declarations)
                {
                    var targetNode = cloner.CloneNode(declaration);
                    target.ShaderFile.SyntaxTree.Declarations.Add(targetNode);
                    metadataRecorder.SymbolSourcingFrom(source.NodePathService, declaration, target.NodePathService, targetNode, new Dictionary <string, string>());
                }
            }
        }
コード例 #3
0
        protected override void Implementation(CodeFileCSharp input, Parameters inputParameters, IMetadataRecorder metadataRecorder, ILogger logger)
        {
            var outFile = this.Outputs[OutStreamName].CreateCodeFile($"{Path.GetFileNameWithoutExtension(input.Name)}.vertex.glsl") as CodeFileGlsl;

            outFile.ShaderFile = ShaderFile.CreateEmpty();
            outFile.ShaderFile.SyntaxTree.Version = ShaderVersion.GlslEs300;

            outFile.ShaderFile.SyntaxTree.Declarations.Add(new FunctionDeclaration()
            {
                Name = new Identifier()
                {
                    Name = "main"
                },
                TypeSpecifier = new TypeNameSpecifier()
                {
                    Identifier = new Identifier()
                    {
                        Name = "void"
                    }
                },
                Statement = new StatementCompound()
            });
        }