Ejemplo n.º 1
0
        private void TechniquesListView_SelectedIndexChanged(object sender, EventArgs e)
        {
            FxcTechnique t = null;

            if (TechniquesListView.SelectedItems.Count == 1)
            {
                t = TechniquesListView.SelectedItems[0].Tag as FxcTechnique;
            }

            LoadTechnique(t);
        }
Ejemplo n.º 2
0
        private void LoadTechnique(FxcTechnique t)
        {
            if (t == null)
            {
                TechniquePanel.Enabled = false;
                TechniqueTextBox.Text  = string.Empty;
            }
            else
            {
                TechniquePanel.Enabled = true;
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("technique " + t.Name);
                sb.AppendLine("{");
                if (t.Passes != null)
                {
                    for (int i = 0; i < t.Passes.Length; i++)
                    {
                        var pass = t.Passes[i];
                        sb.AppendLine(" pass p" + i.ToString());// + pass.ToString());
                        sb.AppendLine(" {");

                        var vs = Fxc?.GetVS(pass.VS);
                        var ps = Fxc?.GetPS(pass.PS);
                        var cs = Fxc?.GetCS(pass.CS);
                        var ds = Fxc?.GetDS(pass.DS);
                        var gs = Fxc?.GetGS(pass.GS);
                        var hs = Fxc?.GetHS(pass.HS);

                        if (vs != null)
                        {
                            sb.AppendLine("  vertexShader = " + vs.Name + "();");
                        }
                        if (ps != null)
                        {
                            sb.AppendLine("  pixelShader = " + ps.Name + "();");
                        }
                        if (cs != null)
                        {
                            sb.AppendLine("  computeShader = " + cs.Name + "();");
                        }
                        if (ds != null)
                        {
                            sb.AppendLine("  domainShader = " + ds.Name + "();");
                        }
                        if (gs != null)
                        {
                            sb.AppendLine("  geometryShader = " + gs.Name + "();");
                        }
                        if (hs != null)
                        {
                            sb.AppendLine("  hullShader = " + hs.Name + "();");
                        }

                        if ((pass.Params != null) && (pass.Params.Length > 0))
                        {
                            //TODO: properly display the params (what are they all? cbuffers etc)

                            //sb.AppendLine();
                            //foreach (var param in pass.Params)
                            //{
                            //    sb.AppendLine("  " + param.ToString());
                            //}
                        }
                        sb.AppendLine(" }");
                    }
                }
                sb.AppendLine("}");
                TechniqueTextBox.Text = sb.ToString();
            }
        }