public override void LoadModuleSettings(HashTableSettings settings) { // Load random template Random ran = new Random(); // series foreach (string serie in serieNames) { int r = (int)(ran.NextDouble() * 255f); int g = (int)(ran.NextDouble() * 255f); int b = (int)(ran.NextDouble() * 255f); Color baseColor = Color.FromArgb(r, g, b); series[serie] = new AtomMaterial(baseColor); } // elements ElementPTFactory ptElements = ElementPTFactory.Instance; foreach (PeriodicTableElement element in ptElements) { int r = (int)(ran.NextDouble() * 255f); int g = (int)(ran.NextDouble() * 255f); int b = (int)(ran.NextDouble() * 255f); Color baseColor = Color.FromArgb(r, g, b); IMoleculeMaterial serieMat = null; series.TryGetValue(element.ChemicalSerie, out serieMat); elements[element.Symbol] = new MoleculeMaterialTemplate(new AtomMaterial(baseColor), serieMat); } }
public void Init(HashTableSettings gSettings, Ribbon mainRibbon) { ribbon = mainRibbon; devSettings = (bool)gSettings["DeveloperMode"]; appDir = Application.StartupPath + "\\"; globalSettings = gSettings; // load recent files if (File.Exists(appDir + "recentFiles.xml")) { recentFiles = RecentFiles.LoadFromFile(appDir + "recentFiles.xml"); recentFiles.ClearDeadEntires(); } else { recentFiles = new RecentFiles(); } RebuildRecentFilesMenu(); baseDir = /*(string)gSettings["Base.Path"];*/ Path.GetFullPath(ConfigurationManager.AppSettings[(devSettings ? "dev@" : "") + "Base.Path.Relative"].Replace("%STARTUP%", Application.StartupPath)); if (!Directory.Exists(baseDir)) { throw new ApplicationException("Base directory does not exist! : " + baseDir); } cdi = ICommonDeviceInterface.NewInterface((byte)globalSettings["CDI.Adapter"], baseDir); cdi.ResourceLoader.RegisterContentLoader(new LayerContentLoader()); cdi.ResourceLoader.RegisterContentLoader(new BooScriptContentLoader()); ShowHideGroups(false); }
public OptionsWindow(HashTableSettings settings) { InitializeComponent(); this.globals = HashTableSettings.globalTable; ScanAdapters(); //SetSettings(settings); }
/*private void StopViewRecording() * { * if (currentSelected != null) * currentSelected.ChemControl.StopRecording(); * } * * private void StartViewRecording() * { * if (currentSelected != null) * currentSelected.ChemControl.StartRecording(null); * } * * private void EditRecordingSettings() * { * VideoEncSettings dlg = new VideoEncSettings(RecordingSettings.DefaultsInstance); * dlg.ShowDialog(); * dlg.Dispose(); * }*/ #endregion #region Events void OnTabChanged() { // load settings if view tab if (ActiveMdiChild is ViewTab) { currentSelected = (ViewTab)ActiveMdiChild; HashTableSettings settings = currentSelected.ChemControl.Settings; if (settings != null) { // set values bgColorButton.SelectedColor = (Color)settings["View3D.BgClr"]; label2.Text = currentSelected.Text; label4.Text = currentSelected.ChemControl.NumAtoms.ToString(); label6.Text = currentSelected.ChemControl.NumBonds.ToString(); } ShowHideGroups(true); } else { // disable groups ShowHideGroups(false); } }
public DevEnvIDEWindow(HashTableSettings gSettings) { InitializeComponent(); devSettings = (bool)gSettings["DeveloperMode"]; appDir = Application.StartupPath + "\\"; globalSettings = gSettings; // load recent files if (File.Exists(appDir + ChemDevEnv.Properties.Resources.RecentFilesListLocation)) { recentFiles = RecentFiles.LoadFromFile(ChemDevEnv.Properties.Resources.RecentFilesListLocation); recentFiles.ClearDeadEntires(); } else { recentFiles = new RecentFiles(); } RebuildRecentFilesMenu(); cdi = ICommonDeviceInterface.NewInterface((byte)globalSettings["CDI.Adapter"], Path.GetFullPath(Application.StartupPath + ConfigurationSettings.AppSettings[(devSettings ? "dev@" : "") + "Base.Path.Relative"])); }
public ShadowMappingEffect(Device device, HashTableSettings settings, ushort lod) : base("Shadow Map", device, settings, 0, 3, lod) { efxType = EffectType.Shading; oReqs[0] = new OutputRequirements(DeviceType.Hardware, true, new Version(1, 1), new Version(1, 1)); oReqs[1] = new OutputRequirements(DeviceType.Hardware, true, new Version(1, 1), new Version(2, 0)); }
public PPixelLightEffect(Device device, HashTableSettings settings, ushort lod) : base("Adv. Lighting", device, settings, 0, 1, lod) { efxType = EffectType.Shading; oReqs[0] = new OutputRequirements(DeviceType.Hardware, true, new Version(1, 1), new Version(1, 1)); oReqs[1] = new OutputRequirements(DeviceType.Hardware, true, new Version(1, 1), new Version(2, 0)); }
public RenderingContext3D(Control targetRenderArea, GraphicsProfile profile, CommonDeviceInterface cdi, HashTableSettings localSettings) { isDeviceLost = false; isActive = false; hasFocus = false; this.targetRenderArea = targetRenderArea; outProfile = profile; log = cdi.GeneralLog; presentParams = new PresentParameters(); outCaps = cdi.DeviceCaps; layers = new LayerStack(); InitializeEnvironment(cdi, localSettings); view3D = new RenderingView3DPer(Matrix.Identity, Matrix.Identity); view3D.Near = 0.1f; view3D.Far = 25; int sceneSize = 60; sManager = new GenericSceneManager <SceneEntity>(gDevice, outSettings, new Vector3(sceneSize / 2f, sceneSize / 2f, sceneSize / 2f), sceneSize); }
protected virtual void InitializeEnvironment(CommonDeviceInterface cdi, HashTableSettings localSettings) { // Get device settings if (outCaps == null) { outCaps = GraphicsDeviceCaps.GetDefaultAdapterCaps(outProfile.RecommendedVariations[0]); } // find first recommended settings with full match bool fullMatch = false; outSettings = GraphicsDeviceSettings.CreateFromRequirements(outProfile.RecommendedVariation, outCaps, outProfile.MinReqs, out fullMatch); // Set up the presentation parameters presentParams.Windowed = outProfile.RecommendedVariations[0].Windowed; presentParams.SwapEffect = SwapEffect.Discard; presentParams.AutoDepthStencilFormat = outSettings.DepthFormat; presentParams.EnableAutoDepthStencil = (outSettings.DepthFormat != DepthFormat.Unknown); presentParams.MultiSample = outSettings.MultiSample; CreateDevice(); devIf = new DeviceInterface(gDevice, cdi, localSettings); gPipeline = new GraphicsPipeline(gDevice); }
public override void Init(HashTableSettings settings, ICommonDeviceInterface cdi) { base.Init(settings, cdi); renderContext = rContext = new VisRenderingContext3D(settings, this, (CommonDeviceInterface)cdi, profiles[0]); renderContext.BackColor = BackColor; }
public DeviceInterface(Device device, CommonDeviceInterface cdi, HashTableSettings localSettings) { this.device = device; this.cdi = cdi; this.localSettings = localSettings; resourceSet = new ResourceSet(device); cdi.Resources.AddSet(resourceSet); }
// Texture testTexture; public BloomEffect(Device device, HashTableSettings settings) : base("Bloom", device, settings, 0, 0, 0) { efxType = EffectType.Shading; oReqs[0] = new OutputRequirements(DeviceType.Hardware, true, new Version(2, 0), new Version(1, 1)); this.numPasses = 4; }
public RenderingEffect(string name, Device device, HashTableSettings settings, ushort minLod, ushort maxLod, ushort lod) { this.name = name; this.device = device; this.settings = settings; this.lodR = new LevelOfDetailRange(minLod, maxLod); this.oReqs = new OutputRequirements[lodR.Max - lodR.Min + 1]; this.lod = lod; }
private void Splash_Load(object sender, EventArgs e) { // load global settings using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ChemDevEnv.Resources.DefaultGlobalSettings.xml")) { globalSettings = HashTableSettings.LoadFromXml(new StreamReader(stream)); } globalSettings["DeveloperMode"] = dev; // start fade out timer1.Start(); }
public static HashTableSettings LoadConfig(SplashDlg dlg, bool devSettings) { if (dlg != null) { while (!dlg.loadedForm) { Thread.Sleep(100); } } HashTableSettings gSettings; if (dlg != null) { dlg.BeginInvoke(dlg.UpdateTextDelegate, dlg.label4, "global settings", false); } Version version = Assembly.GetExecutingAssembly().GetName().Version; if (dlg != null) { string text; if (version.Major > 0) { text = version.ToString(); } else if (version.Minor > 0) { text = string.Format("Beta Build {0}.{1}.{2}", version.Minor, version.Build, version.Revision); } else { text = string.Format("Alpha Build {0}.{1}", version.Build, version.Revision); } dlg.BeginInvoke(dlg.UpdateTextDelegate, dlg.label1, text, false); } // load global settings gSettings = HashTableSettings.LoadFromXml(NuGenDEMVis.Properties.Resource1.DefaultGlobalSettings, false); gSettings.GlobalOnly = true; gSettings["Assembly.Version"] = version; gSettings["Base.Path"] = Path.GetFullPath(ConfigurationManager.AppSettings[(devSettings ? "dev@" : "") + "Base.Path.Relative"].Replace("%STARTUP%", Application.StartupPath)); if (dlg != null) { dlg.BeginInvoke(dlg.DoneLoadingDelegate); } return(gSettings); }
public MoleculeSchemeDlg(HashTableSettings settings, OutputCaps outCaps, Device device, CompleteOutputDescription coDesc) { InitializeComponent(); currentEffects = new List <Effect>(); this.settings = settings; LoadLocalResources(); this.refDevice = device; this.outCaps = outCaps; this.refcoDesc = coDesc; this.coDesc = new CompleteOutputDescription(coDesc); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("NuGenSVisualLib.LightingPresets.config")) { LoadLightingPresets(stream); } SetupLightingPreview(); SetupEffectPreview(); schemePreviewControl.OnNewPreview += new EventHandler(schemePreviewControl_OnNewPreview); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("NuGenSVisualLib.MoleculeSchemes.config")) { if (stream != null) { XmlDocument xml = new XmlDocument(); xml.Load(stream); LoadSchemes(xml); LoadEffects(xml); LoadMaterials(xml); } } previewReady = true; updateThread = new Thread(this.UpdatePreviewsProcess); updateThread.Start(); }
private void NewVisualizationFromImg() { // open data sourcing dialog OpenFileDialog openDlg = new OpenFileDialog(); openDlg.Title = "Open Image"; openDlg.Filter = fileFilter; openDlg.InitialDirectory = baseDir; if (openDlg.ShowDialog(this) == DialogResult.OK) { NewVisDlg dlg = new NewVisDlg(openDlg.FileName, fileTypes, dataProfiles); if (dlg.ShowDialog(this) == DialogResult.OK) { // create visualization UI3DVisControl control = new UI3DVisControl(); VisViewTab tab = new VisViewTab(control); control.Title = tab.Text = dlg.VisName; tab.MdiParent = this; tab.Show(); HashTableSettings localSettings = new HashTableSettings(); //localSettings["Base.Path"] = baseDir; localSettings["GeometryVis.HeightShadingEnabled"] = false; localSettings["GeometryVis.HeightShadingClr"] = Color.Red; control.Init(localSettings, cdi); OnTabChanged(); control.LoadVisualization(dlg.VisDataProfile, dlg.VisSubDataProfile, dlg.VisDataReader, dlg.VisDataSourceInfo); OnTabChanged(); dlg.VisDataReader = null; recentFiles.AddFile(openDlg.FileName, RecentFiles.RecentFileType.Molecule); RebuildRecentFilesMenu(); } dlg.Dispose(); } }
public void SetSettings(HashTableSettings settings) { // configure all controls with settings this.settings = settings; this.globals = HashTableSettings.globalTable; // general uiGenUIClrSchemeComboBox.SelectedIndex = (byte)globals["CDE.UI.Office2007ClrScheme"]; uiStartupWinMax.Checked = ((string)globals["CDE.Startup.WindowSize"] == "100"); uiStartupWin70.Checked = ((string)globals["CDE.Startup.WindowSize"] == "70"); uiStartupWin50.Checked = ((string)globals["CDE.Startup.WindowSize"] == "50"); // view uiViewAdaptersListBox.SelectedIndex = (byte)globals["CDI.Adapter"]; uiViewBgClrBtn.SelectedColor = (Color)globals["View3D.Bg.Clr"]; uiViewFontPicker.SelectedValue = new FontFamily((string)globals["View3D.Font.Family"]); uiViewFontAA.Checked = (bool)globals["View3D.Font.AntiAlias"]; }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ProgramArgs progArgs = new ProgramArgs(args); // Start splash if required bool devMode = progArgs.CheckSwitch("-dev"); SplashDlg splash = null; if (!devMode || progArgs.CheckSwitch("-splash")) { Thread splashTh = new Thread(SplashProcess); splashTh.Start(splash = new SplashDlg()); } // load config and feed splash if present HashTableSettings gSettings = SplashDlg.LoadConfig(splash, devMode); Application.Run(new MainWindow(gSettings, devMode)); }
public MainWindow(HashTableSettings gSettings, bool devMode) { InitializeComponent(); if (gSettings == null) { throw new Exception("No global settings loaded"); } //gSettings = HashTableSettings.LoadFromXml(NuGenDEMVis.Properties.Resource1.DefaultGlobalSettings, false); gSettings["DeveloperMode"] = devMode; Init(gSettings, ribbon1); LoadFileTypes(); LoadProfiles(); Text += " [" + gSettings["Assembly.Version"] + "]"; // TODO: proper measurements and cap size? //explorerBarContainerControl3.Height = 64 * 4; }
public override void LoadModuleSettings(HashTableSettings settings) { //settings["Materials.Molecules.IMoleculeMaterialLookup"] = this; // load molecule settings from xml resource ColorConverter cc = new ColorConverter(); Stream str = Assembly.GetExecutingAssembly().GetManifestResourceStream("NuGenSVisualLib.Molecule.config"); XmlDocument doc = new XmlDocument(); doc.Load(str); // load series settings XmlNodeList series = doc.SelectNodes("configuration/chemicalSeries/chemicalSerie"); foreach (XmlNode serie in series) { string id = serie.Attributes["id"].InnerText; Color baseColor = (Color)cc.ConvertFromString(serie.SelectSingleNode("color").Attributes["desc"].InnerText); this.series[id] = new AtomMaterial(baseColor); } // load symbols XmlNodeList symbols = doc.SelectNodes("configuration/chemicalSymbols/symbol"); ElementPTFactory ptElements = ElementPTFactory.Instance; foreach (XmlNode symbol in symbols) { string id = symbol.Attributes["id"].InnerText; Color baseColor = (Color)cc.ConvertFromString(symbol.SelectSingleNode("color").Attributes["desc"].InnerText); PeriodicTableElement element = ptElements.getElement(id); IMoleculeMaterial serie = null; this.series.TryGetValue(element.ChemicalSerie, out serie); elements[id] = new MoleculeMaterialTemplate(new AtomMaterial(baseColor), serie); } }
private void OpenMolecule(string filename) { //try //{ LoadingProgressDlg dlg = new LoadingProgressDlg(filename); dlg.ShowDialog(); IChemFileWrapper chemFile = dlg.LoadedChemFile; //MoleculeLoader.LoadFromFile(filename); Chem3DControl control = new Chem3DControl(); ViewTab tab = new ViewTab(control); tab.Text = chemFile.filename; tab.MdiParent = this; tab.Show(); HashTableSettings settings = new HashTableSettings(); settings["Base.Path"] = Path.GetFullPath(Application.StartupPath + ConfigurationSettings.AppSettings[(devSettings ? "dev@" : "") + "Base.Path.Relative"]); // /*+ "\\");*/ + "..\\..\\..\\..\\..\\..\\"); control.Init(settings, cdi); control.LoadFile(chemFile); control.OnEntitySelected += control_OnEntitySelected; control.OnRenderUpdate = onRenderUpdate; OnTabChanged(); //} //catch (UserLevelException ule) //{ // MessageBox.Show(this, ule.Message, "Problem Loading File", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); // return; //} //catch { MessageBox.Show(this, "Error loading", "Problem Loading File", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } recentFiles.AddFile(filename, RecentFiles.RecentFileType.Molecule); RebuildRecentFilesMenu(); // load outline LoadOutline((IChemFile)control.GetRootNode()); }
public virtual void Init(HashTableSettings settings, ICommonDeviceInterface cdi) { this.settings = settings; // load settings BackColor = (Color)settings["View3D.BgClr"]; // filter profiles into supported // NOTE: Profiles should be done in CDI really List <GraphicsProfile> sProfiles = new List <GraphicsProfile>(); foreach (GraphicsProfile profile in profiles) { if (GraphicsDeviceManager.CheckAdapterMeetsRequirements(((CommonDeviceInterface)cdi).Adapter, profile.MinReqs)) { sProfiles.Add(profile); // decide which recommendation to use profile.RecommendedVarInUse = -1; for (int i = 0; i < profile.RecommendedVariations.Length; i++) { if (GraphicsDeviceManager.CheckAdapterMeetsRequirements(((CommonDeviceInterface)cdi).Adapter, profile.RecommendedVariations[i])) { profile.RecommendedVarInUse = i; break; } } } } // TODO: This needs to feed back to UI? supportedProfiles = sProfiles.ToArray(); if (supportedProfiles.Length == 0) { throw new Exception("None of the available graphics profiles meet the graphics devices capabilities"); } }
public void Init(HashTableSettings settings, ICommonDeviceInterface cdi) { this.settings = settings; settings["Molecule.Shading.Material.Type"] = "BySerie"; // load settings BackColor = (Color)settings["View3D.BgClr"]; // load local modules foreach (ISettingsModule module in modules) { module.LoadModuleSettings(settings); } renderContext = new ChemRenderingContext3DDX9(settings, this, (CommonDeviceInterface)cdi); renderContext.BackColor = BackColor; // load default output settings CompleteOutputDescription desc = CompleteOutputDescription.LoadDescription(Assembly.GetExecutingAssembly().GetManifestResourceStream("NuGenSVisualLib.defaultOutput.xml")); desc.SchemeSettings = new BallAndStickSchemeSettings(); desc.SchemeSettings.AtomLOD = 2; ApplySettings(desc); }
public PostProcessingRenderingEffect(string name, Device device, HashTableSettings settings, ushort minLod, ushort maxLod, ushort lod) : base(name, device, settings, minLod, maxLod, lod) { }
public PerlinImprovedNoiseEffect(Device device, HashTableSettings settings) : base("Perlin Noise", device, settings, 0, 0, 0) { efxType = EffectType.Shading; oReqs[0] = new OutputRequirements(DeviceType.Hardware, true, new Version(1, 1), new Version(2, 1)); }
public MetaBlobsEffect(Device device, HashTableSettings settings) : base("Meta-Blobs", device, settings, 0, 0, 0) { efxType = EffectType.ScreenSpace; }
public MetaballEffect(Device device, HashTableSettings settings, ushort lod) : base("Metaball", device, settings, 0, 1, lod) { }
public abstract void LoadModuleSettings(HashTableSettings settings);
public ScreenSpaceRenderingEffect(string name, Device device, HashTableSettings settings, ushort minLod, ushort maxLod, ushort lod) : base(name, device, settings, minLod, maxLod, lod) { }