public FormUpdateVertexShaderField(CSSLTemplate template, ShaderField target) { InitializeComponent(); this.template = template; this.clonedTarget = target.Clone() as ShaderField; }
public FormUpdateStructureField(CSSLTemplate template, StructureField target) { InitializeComponent(); this.template = template; this.target = target; }
public FormUpdateIntermediateStructure(CSSLTemplate template, IntermediateStructure target) { InitializeComponent(); this.template = template; this.clonedTarget = target.Clone() as IntermediateStructure; }
private void 打开OToolStripMenuItem_Click(object sender, EventArgs e) { if (this.openFileDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.currentFile = CSSLTemplate.Load(this.openFileDlg.FileName); Map2UI(this.currentFile); } }
private void 另存为AToolStripMenuItem_Click(object sender, EventArgs e) { CSSLTemplate newFile = ((ICloneable)this.currentFile).Clone() as CSSLTemplate; if (this.saveFileDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { newFile.Fullname = this.saveFileDlg.FileName; newFile.Save(); this.currentFile = newFile; } }
public object Clone() { CSSLTemplate result = new CSSLTemplate(); result.ShaderName = this.ShaderName; result.ProgramType = this.ProgramType; result.VertexShaderFieldList = this.VertexShaderFieldList.Clone() as VertexShaderFieldList; result.GeometryShaderFieldList = this.GeometryShaderFieldList.Clone() as GeometryShaderFieldList; result.FragmentShaderFieldList = this.FragmentShaderFieldList.Clone() as FragmentShaderFieldList; result.StrutureList = this.StrutureList.Clone() as IntermediateStructureList; return(result); }
private void Map2UI(CSSLTemplate template) { this.txtShaderName.Text = template.ShaderName; { for (int index = 0; index < this.cmbShaderProgramType.Items.Count; index++) { if (this.cmbShaderProgramType.Items[index].ToString() == template.ProgramType.ToString()) { this.cmbShaderProgramType.SelectedIndex = index; break; } } } { this.lstVertexShaderField.Items.Clear(); foreach (var item in template.VertexShaderFieldList) { this.lstVertexShaderField.Items.Add(item); } } { this.lstGeometryShaderField.Items.Clear(); foreach (var item in template.GeometryShaderFieldList) { this.lstGeometryShaderField.Items.Add(item); } } { this.lstFragmentShaderField.Items.Clear(); foreach (var item in template.FragmentShaderFieldList) { this.lstFragmentShaderField.Items.Add(item); } } { this.lstStructure.Items.Clear(); foreach (var item in template.StrutureList) { this.lstStructure.Items.Add(item); } } }
internal static CSSLTemplate Load(string fullname) { XElement element = XElement.Load(fullname); if (element.Name != typeof(CSSLTemplate).Name) { throw new Exception(); } CSSLTemplate result = new CSSLTemplate(); result.ShaderName = element.Attribute(strShaderName).Value; result.ProgramType = (ShaderProgramType)Enum.Parse( typeof(ShaderProgramType), element.Attribute(strProgramType).Value); result.VertexShaderFieldList = VertexShaderFieldList.Parse(element.Element(typeof(VertexShaderFieldList).Name)); result.GeometryShaderFieldList = GeometryShaderFieldList.Parse(element.Element(typeof(GeometryShaderFieldList).Name)); result.FragmentShaderFieldList = FragmentShaderFieldList.Parse(element.Element(typeof(FragmentShaderFieldList).Name)); result.StrutureList = IntermediateStructureList.Parse(element.Element(typeof(IntermediateStructureList).Name)); result.Fullname = fullname; return(result); }
private void Map2Template(CSSLTemplate cSSLTemplate) { this.currentFile.ShaderName = this.txtShaderName.Text; this.currentFile.ProgramType = (ShaderProgramType)(this.cmbShaderProgramType.SelectedItem); { this.currentFile.VertexShaderFieldList.Clear(); foreach (var item in this.lstVertexShaderField.Items) { ShaderField shaderField = item as ShaderField; this.currentFile.VertexShaderFieldList.Add(shaderField); } } { this.currentFile.GeometryShaderFieldList.Clear(); foreach (var item in this.lstGeometryShaderField.Items) { ShaderField shaderField = item as ShaderField; this.currentFile.GeometryShaderFieldList.Add(shaderField); } } { this.currentFile.FragmentShaderFieldList.Clear(); foreach (var item in this.lstFragmentShaderField.Items) { ShaderField shaderField = item as ShaderField; this.currentFile.FragmentShaderFieldList.Add(shaderField); } } { this.currentFile.StrutureList.Clear(); foreach (var item in this.lstStructure.Items) { IntermediateStructure structure = item as IntermediateStructure; this.currentFile.StrutureList.Add(structure); } } }
public FormInsertShaderField(CSSLTemplate template) { InitializeComponent(); this.template = template; }
private void 新建NToolStripMenuItem_Click(object sender, EventArgs e) { this.currentFile = new CSSLTemplate(); Map2UI(this.currentFile); }
public FormInsertIntermediateStructure(CSSLTemplate template) { InitializeComponent(); this.template = template; }