private void applyLocalized(object sender, EventArgs e) { Branch branch = FractalManager.SelectedBranch; if (branch != null) { branch.Localized = localizedCheckbox.Checked; } FractalManager.NotifyGeometryChanged(); }
protected override void OnMouseMove(MouseEventArgs ea) { if (!SafeToRender) { return; } if (ea.Location == mousePos) { return; //the mouse didnt actually move, so bail out. } mouseWorldPos = WindowToWorld(ea.X, ea.Y); Vec2 mouseDelta = mouseWorldPos - mouseDownWorldPos; if (EditMode && dragState == DragState.Dragging && hoverBranch != null) { if (hoverType == SelectionType.Translation) { hoverBranch.Transform = CalcDragTranslation(); } else if (hoverType == SelectionType.XAxis) { hoverBranch.Transform = CalcDragXAxis(); } else if (hoverType == SelectionType.YAxis) { hoverBranch.Transform = CalcDragYAxis(); } FractalManager.NotifyGeometryChanged(); } else if (dragState == DragState.Panning) { Vec2 mouseScreenPos = WindowToScreen(ea.X, ea.Y); Pan(mouseScreenPos, mouseDownWorldPos); mouseWorldPos = WindowToWorld(ea.X, ea.Y); } else if (dragState == DragState.RotateScale) { Vec2 mouseScreenPos = WindowToScreen(ea.X, ea.Y); CameraRotateScale(mouseScreenPos, mouseDownWorldPos); mouseWorldPos = WindowToWorld(ea.X, ea.Y); } else { UpdateHover(WindowToScreen(ea.X, ea.Y)); } //Vec2 mouseViewPos = ScreenToView(WindowToScreen(ea.X, ea.Y)); //debugPos = cameraTransform * mouseViewPos; mousePos = ea.Location; base.OnMouseMove(ea); }
private void DoColorSelection(int x, int y) { if (FractalManager.SelectedBranch != null) { float fx = Util.Clamp((float)(x) / (float)(PaletteRes - 1), 0.0f, 1.0f); float fy = Util.Clamp((float)(y) / (float)(PaletteRes - 1), 0.0f, 1.0f); FractalManager.SelectedBranch.Chroma = new Vec2(fx, fy); FractalManager.NotifyGeometryChanged(); Invalidate(); } }
private void displayToolStripMenuItem_Click(object sender, EventArgs e) { if (libraryView.SelectedItems.Count != 1) { return; } ListViewItem item = libraryView.SelectedItems[0]; Fractal selectedFractal = item.Tag as Fractal; if (selectedFractal == null) { return; } FractalManager.SetCurrentCopy(selectedFractal); }
private void load1DToolStripMenuItem_Click(object sender, EventArgs e) { beginDlg(); if (paletteSelect1DForm == null) { paletteSelect1DForm = new PaletteSelect1DForm(); } DialogResult result = paletteSelect1DForm.ShowDialog(); if (result == DialogResult.OK && paletteSelect1DForm.Palette != null) { FractalManager.SetPalette(paletteSelect1DForm.Palette); } endDlg(); }
protected override void OnMouseWheel(MouseEventArgs ea) { if (!SafeToRender) { return; } if (ea.Delta > 0) { FractalManager.ZoomIn(); } else if (ea.Delta < 0) { FractalManager.ZoomOut(); } }
private void backgroundColorPanel_Click(object sender, EventArgs e) { Fractal frac = FractalManager.Fractal; ColorDialog dlg = new ColorDialog(); dlg.Color = Color.FromArgb( Util.ClampByte((int)(frac.BackgroundColor.X * 255.0f)), Util.ClampByte((int)(frac.BackgroundColor.Y * 255.0f)), Util.ClampByte((int)(frac.BackgroundColor.Z * 255.0f))); DialogResult result = dlg.ShowDialog(); if (result == DialogResult.OK) { Color bgc = dlg.Color; Vec4 bgColor = new Vec4((float)bgc.R / 255.0f, (float)bgc.G / 255.0f, (float)bgc.B / 255.0f, (float)bgc.A / 255.0f); frac.BackgroundColor = bgColor; backgroundColorPanel.BackColor = dlg.Color; FractalManager.NotifyToneMapChanged(); } }
private void openLibraryToolStripMenuItem_Click(object sender, EventArgs e) { beginDlg(); OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "Fractal Flame files (*.flame)|*.flame|All Files (*.*)|*.*"; dlg.DefaultExt = "flame"; dlg.CheckFileExists = true; dlg.InitialDirectory = Config.FractalDir; DialogResult dlgResult = dlg.ShowDialog(); if (dlgResult == DialogResult.OK) { bool loadOk = false; try{ FractalManager.ReadFromFlameFile(dlg.FileName, config); libraryNameLabel.Text = Path.GetFileName(dlg.FileName); loadOk = true; } catch (FileNotFoundException ex) { MessageBox.Show(ex.Message, "File not found", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { ErrorForm.Show(Narratives.Error_FractalOpenFailed, ex); } if (loadOk) { config.CurrentLibraryFile = dlg.FileName; FractronConfig.Save(config); updateLibraryView(); sideBar.SelectedTab = libraryPage; } } endDlg(); }
private void applyVariControls(object sender, EventArgs ea) { Branch branch = FractalManager.SelectedBranch; if (branch == null) { return; } branch.Variations.Clear(); for (int i = 0; i < variControlCount; i++) { if (variDropBoxes[i].SelectedItem is Variation) { branch.Variations.Add(new Branch.VariEntry( (variDropBoxes[i].SelectedItem as Variation).Index, (float)variSpinners[i].Value)); } } FractalManager.NotifyGeometryChanged(); }
private void loadImageToolStripMenuItem_Click(object sender, EventArgs e) { beginDlg(); OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "Supported Image Files|*.bmp;*.gif;*.jpg;*.jpeg;*.jfif;*.png;*.tiff"; dlg.CheckFileExists = true; dlg.CheckPathExists = true; dlg.InitialDirectory = Config.PaletteDir; if (dlg.ShowDialog() == DialogResult.OK) { try{ Palette pal = new Palette(dlg.FileName); FractalManager.SetPalette(pal); } catch (Exception ex) { ErrorForm.Show("Palette Load Failed.", string.Format("Could not open palette file \"{0}\".", dlg.FileName), ex); } } endDlg(); }
private void openFractronFileToolStripMenuItem_Click(object sender, EventArgs e) { beginDlg(); OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "Fractron 9000 files (*.fractron)|*.fractron|All Files (*.*)|*.*"; dlg.DefaultExt = "fractron"; dlg.CheckFileExists = true; dlg.InitialDirectory = Config.FractalDir; if (dlg.ShowDialog() == DialogResult.OK) { try{ Fractal frac = FractronFileIO.ReadFractronFile(dlg.FileName); FractalManager.SetCurrentCopy(frac); }catch (Exception ex) { ErrorForm.Show("IO Error", "Failed to open .fractron file.", ex); } } endDlg(); }
protected override void OnKeyDown(KeyEventArgs e) { if (e.KeyCode == Keys.ShiftKey) { dragModifier |= DragModifier.Shift; } else if (e.KeyCode == Keys.ControlKey || e.KeyCode == Keys.C) { dragModifier |= DragModifier.Ctrl; } else if (e.KeyCode == Keys.Menu || e.KeyCode == Keys.A) { dragModifier |= DragModifier.Alt; } else if (e.KeyCode == Keys.Space) { FractalManager.SendBlip(); } else { base.OnKeyDown(e); } //Invalidate(); }
private bool engineErrorShown = false; //set to true the first time an engine error dialog is shown #endregion #region Constructor of DOOOOOM public MainForm() { engineMgr = new EngineManager(this); InitializeComponent(); if (this.DesignMode) { return; } FractronConfig.DoInitialSetup(); try{ config = FractronConfig.Load(); } catch (Exception ex) { ErrorForm.Show(Narratives.Error_InitConfigLoadFailed, ex); config = new FractronConfig(); } renderer.MainForm = this; renderer.HandleCreated += new EventHandler(renderer_HandleCreated); renderer.InitContext(); FractalManager.Init(); try{ FractalManager.ReadFromFlameFile(config.CurrentLibraryFile, config); libraryNameLabel.Text = Path.GetFileName(config.CurrentLibraryFile); } catch (Exception ex) { string msg = string.Format(Narratives.Error_FlameLoadFailed, config.CurrentLibraryFile); ErrorForm.Show(msg, ex); } if (FractalManager.Fractals.Count > 0) { FractalManager.SetCurrentCopy(FractalManager.Fractals[0]); } brightnessSpinner.ValueChanged += (sender, e) => { FractalManager.Fractal.Brightness = (float)brightnessSpinner.Value; FractalManager.NotifyToneMapChanged(); }; gammaSpinner.ValueChanged += (sender, e) => { FractalManager.Fractal.Gamma = (float)gammaSpinner.Value; FractalManager.NotifyToneMapChanged(); }; vibrancySpinner.ValueChanged += (sender, e) => { FractalManager.Fractal.Vibrancy = (float)vibrancySpinner.Value; FractalManager.NotifyToneMapChanged(); }; weightSpinner.ValueChanged += (sender, e) => { if (FractalManager.SelectedBranch != null) { FractalManager.SelectedBranch.Weight = (float)weightSpinner.Value; FractalManager.NotifyGeometryChanged(); } }; colorWeightSpinner.ValueChanged += (sender, e) => { if (FractalManager.SelectedBranch != null) { FractalManager.SelectedBranch.ColorWeight = (float)colorWeightSpinner.Value; FractalManager.NotifyGeometryChanged(); } }; localizedCheckbox.CheckedChanged += applyLocalized; variDropBoxes = new ComboBox[variControlCount]; variSpinners = new DragSpin[variControlCount]; int variDropWidth = variGroupBox.ClientSize.Width - 76; int y = 38; for (int i = 0; i < variControlCount; i++) { ComboBox variDropBox = new ComboBox(); DragSpin variSpinner = new DragSpin(); variDropBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; variDropBox.Size = new System.Drawing.Size(variDropWidth, 21); variDropBox.Location = new System.Drawing.Point(6, y); variDropBox.TabIndex = 2 * i; if (i > 0) { variDropBox.Items.Add("<none>"); } foreach (Variation vari in Variation.Variations) { variDropBox.Items.Add(vari); } variDropBox.SelectedIndexChanged += applyVariControls; variSpinner.Size = new System.Drawing.Size(58, 20); variSpinner.Location = new System.Drawing.Point(variGroupBox.ClientSize.Width - 64, y); variSpinner.FormatString = "0.###"; variSpinner.MinVal = 0.0; variSpinner.MaxVal = 1.0; variSpinner.MinorTicksPerMajorTick = 12; variSpinner.PixelsPerMinorTick = 24; variSpinner.TabIndex = 2 * i + 1; variSpinner.ValueChanged += applyVariControls; y += variDropBox.Height + 6; helpProvider.SetHelpString(variDropBox, "Selects a variation to apply to the current branch."); helpProvider.SetHelpString(variSpinner, "Adjusts the weight of a variation."); variGroupBox.Controls.Add(variDropBox); variGroupBox.Controls.Add(variSpinner); variDropBoxes[i] = variDropBox; variSpinners[i] = variSpinner; } variGroupBox.Size = new Size(variGroupBox.Width, y); helpifyControl(this, null); FractalManager.CurrentFractalChanged += handleCurrentFractalChange; FractalManager.BranchSelected += (frac) => { updateBranchControls(); }; //foreach(var spin in branchOptsPanel.Controls.OfType<DragSpin>()) // spin.ValueChanged += HandleFactorSpinnerValueChange; FractalManager.PaletteChanged += (frac) => { engineMgr.MarkPaletteDirty(); }; FractalManager.ToneMapChagned += (frac) => { engineMgr.MarkToneMapDirty(); }; FractalManager.GeometryChanged += (frac) => { engineMgr.MarkGeometryDirty(); }; nameTextBox.TextChanged += applyFractalName; updateLibraryView(); updateToneControls(); handleCurrentFractalChange(FractalManager.Fractal); updateBranchControls(); chooseDesiredEngineState(); }
private void newToolStripMenuItem_Click(object sender, EventArgs e) { FractalManager.LoadNewFractal(); }
private void flipVerticalToolStripMenuItem_Click(object sender, EventArgs e) { FractalManager.FlipVertical(); }
private void loadDefaultToolStripMenuItem_Click(object sender, EventArgs e) { FractalManager.SetPalette(Palette.DefaultPalette); }
private void resetViewToolStripMenuItem_Click(object sender, EventArgs e) { FractalManager.Fractal.CameraTransform = new Affine2D(2.0f, 0.0f, 0.0f, 2.0f, 0.0f, 0.0f); FractalManager.NotifyGeometryChanged(); }
private void prevToolStripMenuItem_Click(object sender, EventArgs e) { FractalManager.PrevFractal(); }
private void nextToolStripMenuItem_Click(object sender, EventArgs e) { FractalManager.NextFractal(); }
private void duplicateBranchToolStripMenuItem_Click(object sender, EventArgs e) { FractalManager.DuplicateSelectedBranch(); }
public void LoadGameObjects() { Debug.Log("Loading Game Objects Into Game Manager"); if (this.Mendelbulb == null) { this.Mendelbulb = GameObject.Find("Mandelbulb"); } if (this.Sun == null) { this.Sun = GameObject.Find("Sun"); } if (this.Moon == null) { this.Moon = GameObject.Find("Moon"); } if (this.StarSprites == null) { this.StarSprites = GameObject.Find("Stars"); } if (this.InteractableOrbs == null) { this.InteractableOrbs = GameObject.Find("InteractableOrbs"); } if (this.interactableManager == null && this.InteractableOrbs != null) { this.interactableManager = this.InteractableOrbs.GetComponent <InteractableManager>(); } if (this.RFloor == null) { this.RFloor = GameObject.Find("Floor- Reflective"); } if (this.Rings == null) { this.Rings = GameObject.Find("Rings"); } if (this.ringManagerScript == null) { this.ringManagerScript = this.Rings.GetComponent <RingManager>(); } if (this.PlanetOrbit == null) { this.PlanetOrbit = GameObject.Find("PlanetOrbit"); } if (this.mandelBulbOrbitScript == null) { this.mandelBulbOrbitScript = this.PlanetOrbit.GetComponent <Orbit>(); } if (this.dayNightScript == null) { this.dayNightScript = this.GetComponent <DayNight>(); } if (this.mandelBulbScript == null && Mendelbulb != null) { this.mandelBulbScript = Mendelbulb.GetComponent <FractalManager>(); } if (this.mandelBulbRig == null && Mendelbulb != null) { this.mandelBulbRig = Mendelbulb.GetComponent <Rigidbody>(); } if (this.skyboxManager == null) { this.skyboxManager = this.GetComponent <SkyboxManager>(); } }
private void removeBranchToolStripMenuItem_Click(object sender, EventArgs e) { FractalManager.RemoveSelectedBranch(); }
private void invertBranchToolStripMenuItem_Click(object sender, EventArgs e) { FractalManager.InvertSelectedBranch(); }
private void zoomOutToolStripMenuItem_Click(object sender, EventArgs e) { FractalManager.ZoomOut(); }
public void MakeGameManager() { Debug.Log("Loading Game Objects Into Game Manager"); // Loading Null components if (this.Room == null) { this.Room = GameObject.Find("Box"); } if (this.RoomLid == null) { this.RoomLid = GameObject.Find("Lid"); } if (this.Mendelbulb == null) { this.Mendelbulb = GameObject.Find("Mandelbulb"); } if (this.Sun == null) { this.Sun = GameObject.Find("Sun"); } if (this.Moon == null) { this.Moon = GameObject.Find("Moon"); } if (this.BlueLight == null) { GameObject tmpObj = GameObject.Find("Blue Light"); if (tmpObj != null) { this.BlueLight = tmpObj.GetComponent <Material>(); } else { Debug.Log("Could not find Blue Light"); } } if (this.YellowLight == null) { GameObject tmpObj = GameObject.Find("Yellow Light"); if (tmpObj != null) { this.YellowLight = tmpObj.GetComponent <Material>(); } else { Debug.Log("Could not find Yellow Light"); } } if (this.PinkLight == null) { GameObject tmpObj = GameObject.Find("Pink Light"); if (tmpObj != null) { this.PinkLight = tmpObj.GetComponent <Material>(); } else { Debug.Log("Could not find Pink Light"); } } if (this.StarSprites == null) { this.StarSprites = GameObject.Find("Stars"); } if (this.Sofa == null) { GameObject tmpObj = GameObject.Find("Sofa"); if (tmpObj != null) { this.Sofa = tmpObj.GetComponent <Material>(); } else { Debug.Log("Could not find Sofa"); } } if (this.VRCanvas == null) { this.VRCanvas = GameObject.Find("VRCanvas"); } if (this.PointLight == null) { this.PointLight = GameObject.Find("Point Light"); } if (this.InteractableOrbs == null) { this.InteractableOrbs = GameObject.Find("InteractableOrbs"); } if (this.SkipSceneCanvas == null) { this.SkipSceneCanvas = GameObject.Find("SkipSceneCanvas"); } if (this.RFloor == null) { this.RFloor = GameObject.Find("Floor- Reflective"); } if (this.TutorialCanvas == null) { this.TutorialCanvas = GameObject.Find("TutorialCanvas"); } if (this.dayNightScript == null) { this.dayNightScript = this.GetComponent <DayNight>(); } if (this.pointLightLight == null) { this.pointLightLight = PointLight.GetComponent <Light>(); } if (this.tutorialCanvasGroup == null) { this.tutorialCanvasGroup = this.TutorialCanvas.GetComponent <CanvasGroup>(); } if (this.mandelBulbScript == null) { this.mandelBulbScript = Mendelbulb.GetComponent <FractalManager>(); } if (this.RoomMaterial == null) { this.RoomMaterial = this.Room.GetComponent <Material>(); } if (this.RoomLidMaterial == null) { this.RoomLidMaterial = this.RoomLid.GetComponent <Material>(); } }
private void addBranchToolStripMenuItem_Click(object sender, EventArgs e) { FractalManager.AddBranch(); }