protected override CodeFile CreateCodeFile(string id, string name) { var result = new CodeFileGlsl(id, name); result.ShaderFile = ShaderFile.CreateEmpty(); return(result); }
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>()); } } }