/// <summary> /// Constructor /// </summary> /// <param name="substance">Substance</param> /// <param name="style">Style</param> public Render(Substance substance, Style style) { this.substance = substance; this.style = style; handle = CreateRender(); style.ColorStyle.ColorScheme.Invalidated += OnColorSchemeInvalidated; style.ColorStyle.Invalidated += OnColorStyleInvalidated; style.GeometryStyle.Invalidated += OnGeometryStyleInvalidated; }
/// <summary> /// Default constructor /// </summary> public PeriodicalTable() { this.InitializeComponent(); /*visualizer.Substance = new Substance(); visualizer.SubstanceStyle = new Style(); Molecule molecule = new Molecule(); molecule.Atoms.Add(new Atom() {Element = Element.GetBySymbol("H")}); visualizer.Substance.Molecules.Add(molecule);*/ // Create a substance & a render to preview material paramenters Substance substance = new Substance(); Molecule molecule = new Molecule(); molecule.Atoms.Add(new Atom() { Element = Element.GetBySymbol("H") }); substance.Molecules.Add(molecule); Render render = new Render(substance, new Style()); output.Render = render; Camera camera = new Camera(); camera.Target = new Point3D(); camera.Distance = Element.GetBySymbol("H").VanderWaalsRadius * 3.0; camera.Aspect = output.Width / output.Height; output.Camera = camera; // Ensure that list box will be focused, so we will be able press Ctrl + Alt to select all IsVisibleChanged += (s, e) => elementsListBox.Focus(); MaterialChanged += (s, e) => UpdatePreview(); }