Пример #1
0
        internal static string PreviewShaderChain(string pic1, string pic2, string pic3)
        {
            Reset();
            string sp = Setup(pic1, pic2, pic3);
            if(sp != null) return sp;

            INIFile iniFile = new INIFile(Statics.iniFileName, ShaderActive.iniShaderWhat, true);
            List<string> shaderList = new List<string>(iniFile.getSectList(ShaderActive.iniShaderChain));
            foreach (string s in shaderList) {
                string path = Statics.runDir + "\\" + Statics.pathShaders + "\\" + s + ".fx";
                Effect effect;

                try {
                    effect = Effect.FromFile(DXMain.device, path, null, null, ShaderFlags.NotCloneable, null);
                    if(effect == null) throw new ApplicationException();
                } catch {
                    return "Shader '"+path+"' failed to load.";
                }

                try {
                    effect.Technique = "T0";
                    effect.ValidateTechnique("T0");
                } catch {
                    return "Shader '"+path+"' failed validation.";
                }

                effects.Add(LoadShaderTextures(effect));
            }

            return null;
        }
Пример #2
0
        public ShaderActive()
        {
            InitializeComponent();
            Statics.Localizations.Apply(this);

            foreach (String s in Directory.GetFiles(Statics.runDir + "\\" + Statics.pathShaders)) {
                if(s.EndsWith(".fx")) lbAvailable.Items.Add(Path.GetFileNameWithoutExtension(s));
            }

            INIFile iniFile = new INIFile(Statics.iniFileName, iniShaderWhat, true);
            List<string> shaderList = new List<string>(iniFile.getSectList(iniShaderChain));
            foreach (string s in shaderList) {
                if (File.Exists(Statics.runDir + "\\" + Statics.pathShaders + "\\" + s + ".fx")) {
                    lbSelected.Items.Add(s);
                }
            }
        }
Пример #3
0
 /* Configuration methods */
 
 // loading all settings
 private void LoadSettings() {
     INIFile iniFile = new INIFile(Statics.iniFileName, iniDLWizardVars, true);
     configure = !iniFile.hasSection(iniDLWizardSets);
     if (configure) {
         iniFile.initialize();
         iniFile.save();
     }
     pluginDirs = new List<string>(iniFile.getSectList(iniDLWizardPlugDirs));
     pluginDirs.Sort();
     string dir2 = "";
     foreach (string s in pluginDirs) {
         string dir1 = s.ToLower(Statics.Culture);
         if (dir1 == dir2) pluginDirs.Remove(s);
         dir2 = dir1;
     }
     pluginList = new MWPlugins(Statics.fn_datafiles, pluginDirs);
     switch ((int)iniFile.getKeyValue("PlugSort")) {
         case 0: rbPlugsName.Checked = true; break;
         case 1: rbPlugsType.Checked = true; break;
         case 2: rbPlugsLoad.Checked = true; break;
     }
     pluginsSort(null, null);
     preselectedPlugins = iniFile.getSectList(iniDLWizardPlugs);
     SelectPlugins(preselectedPlugins);
     cmbTexWorldResolution.SelectedIndex = (int)iniFile.getKeyValue("TexRes");
     cmbTexWorldNormalRes.SelectedIndex = (int)iniFile.getKeyValue("NormRes");
     cbTexTwoStep.Checked = (iniFile.getKeyValue("Tex2Step") == 1);
     cmbMeshWorldDetail.SelectedIndex = (int)iniFile.getKeyValue("WorldMesh");
     udStatMinSize.Value = (int)iniFile.getKeyValue("MinStat");
     udStatGrassDensity.Value = (int)iniFile.getKeyValue("GrassDens");
     cmbStatSimplifyMeshes.SelectedIndex = (int)iniFile.getKeyValue("StatMesh");
     cmbStatSkipMipLevels.SelectedIndex = (int)iniFile.getKeyValue("SkipMip");
     cbStatActivators.Checked = (iniFile.getKeyValue("Activators") == 1);
     cbStatIncludeMisc.Checked = (iniFile.getKeyValue("MiscObj") == 1);
     cbStatOverrideList.Checked = (iniFile.getKeyValue("UseStatOvr") == 1);
     cbStatIntExt.Checked = (iniFile.getKeyValue("StatIntExt") == 1);
     cbStatIntWater.Checked = (iniFile.getKeyValue("StatIntWater") == 1);
     lbStatOverrideList.Items.Clear();
     lbStatOverrideList.Items.AddRange(iniFile.getSectList(iniDLWizardStatOvr));
     lStatOverrideList.Enabled = (lbStatOverrideList.Items.Count == 0);
 }
Пример #4
0
 /* Configuration methods */
 // loading all settings
 private void LoadSettings()
 {
     INIFile iniFile = new INIFile(Statics.iniFileName, iniDLWizardVars, true);
     configure = !iniFile.hasSection(iniDLWizardSets);
     if (configure) {
         iniFile.initialize();
         iniFile.save();
     }
     pluginDirs = new List<string>(iniFile.getSectList(iniDLWizardPlugDirs));
     pluginDirs.Sort();
     string lastdir = Statics.fn_datafiles;
     for (int i = 0; i < pluginDirs.Count; i++ ) {
         if (String.Compare(Path.GetFullPath(pluginDirs[i]), Path.GetFullPath(lastdir), true, Statics.Culture) == 0 ||
             String.Compare(Path.GetFullPath(pluginDirs[i]), Path.GetFullPath(Statics.fn_statics), true, Statics.Culture) == 0 ||
             String.Compare(Path.GetFullPath(pluginDirs[i]), Path.GetFullPath(Statics.fn_datafiles), true, Statics.Culture) == 0)
             pluginDirs.RemoveAt(i--);
         else lastdir = pluginDirs[i];
     }
     pluginDirs.Insert(0, Statics.fn_statics);
     preselectedPlugins = iniFile.getSectList(iniDLWizardPlugs);
     pluginList = new MWPlugins(Statics.fn_datafiles, pluginDirs, preselectedPlugins);
     switch ((int)iniFile.getKeyValue("PlugSort")) {
         case 0: rbPlugsName.Checked = true; break;
         case 1: rbPlugsType.Checked = true; break;
         case 2: rbPlugsLoad.Checked = true; break;
     }
     pluginsSort(null, null);
     cmbTexWorldResolution.SelectedIndex = (int)iniFile.getKeyValue("TexRes");
     cmbTexWorldNormalRes.SelectedIndex = (int)iniFile.getKeyValue("NormRes");
     cbTexTwoStep.Checked = (iniFile.getKeyValue("Tex2Step") == 1);
     cmbMeshWorldDetail.SelectedIndex = (int)iniFile.getKeyValue("WorldMesh");
     udStatMinSize.Value = (int)iniFile.getKeyValue("MinStat");
     udStatGrassDensity.Value = (int)iniFile.getKeyValue("GrassDens");
     cmbStatSimplifyMeshes.SelectedIndex = (int)iniFile.getKeyValue("StatMesh");
     cmbStatSkipMipLevels.SelectedIndex = (int)iniFile.getKeyValue("SkipMip");
     cbStatLowQualTextures.Checked = (iniFile.getKeyValue("LowQualTex") == 1);
     cbStatActivators.Checked = (iniFile.getKeyValue("Activators") == 1);
     cbStatIncludeMisc.Checked = (iniFile.getKeyValue("MiscObj") == 1);
     cbStatOldSimplification.Checked = (iniFile.getKeyValue("OldSimply") == 1);
     cbStatOverrideList.Checked = (iniFile.getKeyValue("UseStatOvr") == 1);
     cbStatIntExt.Checked = (iniFile.getKeyValue("StatIntExt") == 1);
     cbStatIntWater.Checked = (iniFile.getKeyValue("StatIntWater") == 1);
     lbStatOverrideList.Items.Clear();
     lbStatOverrideList.Items.AddRange(iniFile.getSectList(iniDLWizardStatOvr));
     lStatOverrideList.Enabled = (lbStatOverrideList.Items.Count == 0);
 }