public void MatchingTables_Initialize(SelectableListNodeList items) { GuiHelper.InitializeDeselectable(_guiMatchingTables, items); }
/// <summary> /// Constructs the volume interface for both Music and Sound /// @Author Konstantin and Edited by Steven /// </summary> /// <param name="mainScreen"></param> private void createSoundVolume(Screen mainScreen) { /* Sound volume control */ LabelControl soundControlLabel = GuiHelper.CreateLabel("Sound", UIConstants.OPTION_SOUND_LABEL.X, UIConstants.OPTION_SOUND_LABEL.Y, UIConstants.OPTION_SOUND_LABEL.Width, UIConstants.OPTION_SOUND_LABEL.Height); mainScreen.Desktop.Children.Add(soundControlLabel); ButtonControl soundOffButton = GuiHelper.CreateButton("OFF", UIConstants.OPTION_SOUND_OFF_BTN.X, UIConstants.OPTION_SOUND_OFF_BTN.Y, UIConstants.OPTION_SOUND_OFF_BTN.Width, UIConstants.OPTION_SOUND_OFF_BTN.Height); soundOffButton.Pressed += delegate(object sender, EventArgs arguments) { currentSoundLabel.Text = "Off"; game.currentSound = "Off"; SoundEffect.MasterVolume = 0f; }; mainScreen.Desktop.Children.Add(soundOffButton); ButtonControl soundLowButton = GuiHelper.CreateButton("LOW", UIConstants.OPTION_SOUND_LOW_BTN.X, UIConstants.OPTION_SOUND_LOW_BTN.Y, UIConstants.OPTION_SOUND_LOW_BTN.Width, UIConstants.OPTION_SOUND_LOW_BTN.Height); soundLowButton.Pressed += delegate(object sender, EventArgs arguments) { currentSoundLabel.Text = "Low"; game.currentSound = "Low"; SoundEffect.MasterVolume = .10f; }; mainScreen.Desktop.Children.Add(soundLowButton); ButtonControl soundMediumButton = GuiHelper.CreateButton("MED", UIConstants.OPTION_SOUND_MED_BTN.X, UIConstants.OPTION_SOUND_MED_BTN.Y, UIConstants.OPTION_SOUND_MED_BTN.Width, UIConstants.OPTION_SOUND_MED_BTN.Height); soundMediumButton.Pressed += delegate(object sender, EventArgs arguments) { currentSoundLabel.Text = "Medium"; game.currentSound = "Medium"; SoundEffect.MasterVolume = .50f; }; mainScreen.Desktop.Children.Add(soundMediumButton); ButtonControl soundHighButton = GuiHelper.CreateButton("HIGH", UIConstants.OPTION_SOUND_HIGH_BTN.X, UIConstants.OPTION_SOUND_HIGH_BTN.Y, UIConstants.OPTION_SOUND_HIGH_BTN.Width, UIConstants.OPTION_SOUND_HIGH_BTN.Height); soundHighButton.Pressed += delegate(object sender, EventArgs arguments) { currentSoundLabel.Text = "High"; game.currentSound = "High"; SoundEffect.MasterVolume = 1f; }; mainScreen.Desktop.Children.Add(soundHighButton); currentSoundLabel = GuiHelper.CreateLabel(game.currentSound, UIConstants.OPTION_SOUND_CUR_LABEL.X, UIConstants.OPTION_SOUND_CUR_LABEL.Y, UIConstants.OPTION_SOUND_CUR_LABEL.Width, UIConstants.OPTION_SOUND_CUR_LABEL.Height); mainScreen.Desktop.Children.Add(currentSoundLabel); /* Music volume control */ LabelControl musicControlLabel = GuiHelper.CreateLabel("Music", UIConstants.OPTION_MUSIC_LABEL.X, UIConstants.OPTION_MUSIC_LABEL.Y, UIConstants.OPTION_MUSIC_LABEL.Width, UIConstants.OPTION_MUSIC_LABEL.Height); mainScreen.Desktop.Children.Add(musicControlLabel); ButtonControl musicOffButton = GuiHelper.CreateButton("OFF", UIConstants.OPTION_MUSIC_OFF_BTN.X, UIConstants.OPTION_MUSIC_OFF_BTN.Y, UIConstants.OPTION_MUSIC_OFF_BTN.Width, UIConstants.OPTION_MUSIC_OFF_BTN.Height); musicOffButton.Pressed += delegate(object sender, EventArgs arguments) { currentMusicLabel.Text = "Off"; game.currentMusic = "Off"; MediaPlayer.Volume = 0; }; mainScreen.Desktop.Children.Add(musicOffButton); ButtonControl musicLowButton = GuiHelper.CreateButton("LOW", UIConstants.OPTION_MUSIC_LOW_BTN.X, UIConstants.OPTION_MUSIC_LOW_BTN.Y, UIConstants.OPTION_MUSIC_LOW_BTN.Width, UIConstants.OPTION_MUSIC_LOW_BTN.Height); musicLowButton.Pressed += delegate(object sender, EventArgs arguments) { currentMusicLabel.Text = "Low"; game.currentMusic = "Low"; MediaPlayer.Volume = .33f; }; mainScreen.Desktop.Children.Add(musicLowButton); ButtonControl musicMediumButton = GuiHelper.CreateButton("MED", UIConstants.OPTION_MUSIC_MED_BTN.X, UIConstants.OPTION_MUSIC_MED_BTN.Y, UIConstants.OPTION_MUSIC_MED_BTN.Width, UIConstants.OPTION_MUSIC_MED_BTN.Height); musicMediumButton.Pressed += delegate(object sender, EventArgs arguments) { currentMusicLabel.Text = "Medium"; game.currentMusic = "Medium"; MediaPlayer.Volume = .66f; }; mainScreen.Desktop.Children.Add(musicMediumButton); ButtonControl musicHighButton = GuiHelper.CreateButton("HIGH", UIConstants.OPTION_MUSIC_HIGH_BTN.X, UIConstants.OPTION_MUSIC_HIGH_BTN.Y, UIConstants.OPTION_MUSIC_HIGH_BTN.Width, UIConstants.OPTION_MUSIC_HIGH_BTN.Height); musicHighButton.Pressed += delegate(object sender, EventArgs arguments) { currentMusicLabel.Text = "High"; game.currentMusic = "High"; MediaPlayer.Volume = 1f; }; mainScreen.Desktop.Children.Add(musicHighButton); currentMusicLabel = GuiHelper.CreateLabel(game.currentMusic, UIConstants.OPTION_MUSIC_CUR_LABEL.X, UIConstants.OPTION_MUSIC_CUR_LABEL.Y, UIConstants.OPTION_MUSIC_CUR_LABEL.Width, UIConstants.OPTION_MUSIC_CUR_LABEL.Height); mainScreen.Desktop.Children.Add(currentMusicLabel); }
private void EhMatchingTables_SelectionChangeCommit(object sender, SelectionChangedEventArgs e) { GuiHelper.SynchronizeSelectionFromGui(_guiMatchingTables); SelectedMatchingTableChanged?.Invoke(); }
public void AvailableTables_Initialize(SelectableListNodeList items) { GuiHelper.Initialize(_cbTables, items); }
private void EhFourierWindowChanged(object sender, SelectionChangedEventArgs e) { GuiHelper.SynchronizeSelectionFromGui(_guiFourierWindow); }
/// <summary> /// Function that can be called from the main window every time the windows state of the main window changed. /// </summary> /// <param name="mainWindow">The main window.</param> public static void UpdateWorkbenchStateFromMainWindow(Window mainWindow) { if (mainWindow.WindowState == System.Windows.WindowState.Minimized) { return; } var orgObserve = (bool)mainWindow.GetValue(ObserveProperty); mainWindow.SetValue(ObserveProperty, false); WorkbenchState wb; if (mainWindow.RestoreBounds.IsEmpty) { wb = new WorkbenchState { IsMaximized = mainWindow.WindowState == System.Windows.WindowState.Maximized, Bounds = new Altaxo.Geometry.RectangleD2D(mainWindow.Left, mainWindow.Top, mainWindow.ActualWidth, mainWindow.ActualHeight) } } ; else { wb = new WorkbenchState() { IsMaximized = mainWindow.WindowState == System.Windows.WindowState.Maximized, Bounds = GuiHelper.ToAltaxo(mainWindow.RestoreBounds) } }; mainWindow.SetValue(ObservedWorkbenchStateProperty, wb); mainWindow.SetValue(ObserveProperty, orgObserve); } }
/// <summary> /// Fills the "Extend file name by column" combobox with column names. /// </summary> /// <param name="colnames">The array of column names the combobox is filled with.</param> public void FillExtFileNameColumnBox(SelectableListNodeList list) { GuiHelper.UpdateList(m_cbExtFileName_Column, list); }
private void DrawGrid(Rect di) { GuiHelper.DrawRect(di, Color.gray); }
/// <summary> /// Loads application wide cached data into the Application Object. This routine /// is called at startup, when the Application_Start event is thrown. /// </summary> public static void LoadApplicationObjectCacheData() { HttpContext currentHttpContext = HttpContext.Current; NameValueCollection appSettingsCollection = (NameValueCollection)ConfigurationManager.GetSection("appSettings"); // read data from web.config string defaultFromEmailAddress = appSettingsCollection["DefaultFromEmailAddress"].ToString(); string defaultToEmailAddress = appSettingsCollection["DefaultToEmailAddress"].ToString(); string emailPasswordSubject = appSettingsCollection["EmailPasswordSubject"].ToString(); string emailThreadNotificationSubject = appSettingsCollection["EmailThreadNotificationSubject"].ToString(); string siteName = appSettingsCollection["SiteName"].ToString(); string virtualRoot = appSettingsCollection["VirtualRoot"].ToString(); string ipBanComplainEmailAddress = appSettingsCollection["IPBanComplainEmailAddress"].ToString(); int maxAmountMessagesPerPage = Convert.ToInt32(appSettingsCollection["MaxAmountMessagesPerPage"]); string datafilesPath = currentHttpContext.Server.MapPath(appSettingsCollection["DatafilesPath"].ToString()); string ubbMessageTransformXSLPathFilename = appSettingsCollection["UBBMessageTransformXSLPathFilename"].ToString(); string ubbSignatureTransformXSLPathFilename = appSettingsCollection["UBBSignatureTransformXSLPathFilename"].ToString(); // Load XML -> HTML transformation XSL XslCompiledTransform messageStyle = new XslCompiledTransform(); XslCompiledTransform signatureStyle = new XslCompiledTransform(); messageStyle.Load(Path.Combine(datafilesPath, ubbMessageTransformXSLPathFilename)); signatureStyle.Load(Path.Combine(datafilesPath, ubbSignatureTransformXSLPathFilename)); Hashtable noiseWords = GuiHelper.LoadNoiseWordsIntoHashtable(datafilesPath); string registrationReplyMailTemplate = File.ReadAllText(Path.Combine(datafilesPath, "RegistrationReplyMail.template")); string threadUpdatedNotificationTemplate = File.ReadAllText(Path.Combine(datafilesPath, "ThreadUpdatedNotification.template")); // add other email templates here. // fetch all banned users and store them in the set of users to logout by force. DataView bannedNicknames = UserGuiHelper.GetAllBannedUserNicknamesAsDataView(); Hashtable usersToLogoutByForce = new Hashtable(); foreach (DataRowView row in bannedNicknames) { usersToLogoutByForce.Add(row["Nickname"].ToString(), null); } // store them into the application object. HttpApplicationState applicationState = currentHttpContext.Application; try { applicationState.Lock(); applicationState.Add("defaultFromEmailAddress", defaultFromEmailAddress); applicationState.Add("defaultToEmailAddress", defaultFromEmailAddress); applicationState.Add("siteName", siteName); applicationState.Add("virtualRoot", virtualRoot); applicationState.Add("datafilesMapPath", datafilesPath); applicationState.Add("emailPasswordSubject", emailPasswordSubject); applicationState.Add("emailThreadNotificationSubject", emailThreadNotificationSubject); applicationState.Add("messageStyle", messageStyle); applicationState.Add("signatureStyle", signatureStyle); applicationState.Add("noiseWords", noiseWords); applicationState.Add("maxAmountMessagesPerPage", maxAmountMessagesPerPage); applicationState.Add("IPBanComplainEmailAddress", ipBanComplainEmailAddress); applicationState.Add("cacheFlags", new Hashtable()); applicationState.Add("usersToLogoutByForce", usersToLogoutByForce); applicationState.Add("registrationReplyMailTemplate", registrationReplyMailTemplate); applicationState.Add("threadUpdatedNotificationTemplate", threadUpdatedNotificationTemplate); } finally { applicationState.UnLock(); } }
/// <summary> /// This fills the x values column combobox with column names and selects the first index in the column as default. /// </summary> /// <param name="colnames">The array of column names the combobox is filled with.</param> public void FillXValuesColumnBox(SelectableListNodeList list) { GuiHelper.UpdateList(m_cbXValues_Column, list); }
private void EhPixelFormatSelected(object sender, SelectionChangedEventArgs e) { GuiHelper.SynchronizeSelectionFromGui(_cbPixelFormat); }
public void SetDropFilePixelFormat(Altaxo.Collections.SelectableListNodeList list) { GuiHelper.Initialize(_cbPixelFormat, list); }
public void SetOutputQuantities(Collections.SelectableListNodeList list) { GuiHelper.InitializeChoicePanel <RadioButton>(_guiOutputQuantities, list); }
override protected void OnGUIInner() { Texture texture = SpriteManager.GetIntro(); float scale = (float)Screen.height / (float)texture.height; int height = Mathf.RoundToInt(scale * texture.height); int width = Mathf.RoundToInt(scale * texture.width); int x = (Screen.width - width) / 2; GUI.DrawTexture(new Rect(x, GuiHelper.PercentH(0.1), width, height), texture); GuiHelper.ButtonWithText(0.3, 0.9, 0.3, 0.3, "Classic", SpriteManager.GetRoundButton(), GuiHelper.MicroFont, delegate(){ Minigame m = gameObject.AddComponent <Minigame>(); Destroy(this); m.PrepareRace(Game.Me.Player, ScreenAfterMinigameClassic.PrepareScreen, Mission.Classic, Game.Me.ClassicCarConfig); }); GuiHelper.ButtonWithText(0.14, 0.78, 0.15, 0.15, "?", SpriteManager.GetRoundButton(), GuiHelper.MicroFont, delegate(){ ScreenText m = gameObject.AddComponent <ScreenText>(); m.Prepare(delegate() { m.gameObject.AddComponent <ScreenSplash>(); Destroy(m); }, "Classic mode", "In classic mode you drive as far as you get. " + "Pick up oil stains to have fuel, avoid other obstacles." + "\n\nThere are google leaderboards and achievements with global scores, connect to it if you want to compare with others."); Destroy(this); }); GuiHelper.ButtonWithText(0.7, 0.9, 0.3, 0.3, "Adventure", SpriteManager.GetRoundButton(), GuiHelper.MicroFont, delegate(){ gameObject.AddComponent <ScreenAdvModeStart>(); Destroy(this); }); GuiHelper.ButtonWithText(0.85, 0.78, 0.15, 0.15, "?", SpriteManager.GetRoundButton(), GuiHelper.MicroFont, delegate(){ ScreenText m = gameObject.AddComponent <ScreenText>(); m.Prepare(delegate() { m.gameObject.AddComponent <ScreenSplash>(); Destroy(m); }, "Adventure mode", "In adventure mode you have your own car. Upgrade it with coins. " + "Make missions, collect coins in race. Drive further. " + "The farther you get the more coins there will be. " + "Pick up oil stains to have fuel, avoid other obstacles. " + "At some point shields will be available. " + "\n\nThere are google leaderboards with global scores, connect to it if you want to compare with others."); Destroy(this); }); GuiHelper.DrawText("K Bobnis: Design, Programming\nM Bartynski: Design, Concept", GuiHelper.MicroFont, 0.1, 0.1, 0.8, 0.17); if (GUI.Button(new Rect(GuiHelper.PercentW(0.79), GuiHelper.PercentH(0.21), GuiHelper.PercentW(0.2), GuiHelper.PercentH(0.2)), SpriteManager.GetSettingsIcon(), GuiHelper.CustomButton)) { gameObject.AddComponent <ScreenOptions>(); Destroy(this); } }
void DoMyWindow(int windowID) { int spacingX = 0; int spacingY = 50; int spacing2Y = 70; int offsetX = 10; int offsetY = 30; GUI.Label(new Rect(offsetX, offsetY, 250, 30), "Alignment Reveal Slider"); Slider = GUI.HorizontalSlider(new Rect(offsetX, offsetY + 20, 280, 10), Slider, 0.0f, 1.0f); offsetY += 40; GUI.Label(new Rect(offsetX, offsetY, 250, 30), "Preview Map"); offsetY += 30; if (MGS._DiffuseMapOriginal == null) { GUI.enabled = false; } else { GUI.enabled = true; } if (GUI.Button(new Rect(offsetX, offsetY, 130, 30), "Original Diffuse Map")) { textureToAlign = MGS._DiffuseMapOriginal; doStuff = true; } if (MGS._DiffuseMap == null) { GUI.enabled = false; } else { GUI.enabled = true; } if (GUI.Button(new Rect(offsetX + 150, offsetY, 130, 30), "Diffuse Map")) { textureToAlign = MGS._DiffuseMap; doStuff = true; } offsetY += 40; if (MGS._HeightMap == null) { GUI.enabled = false; } else { GUI.enabled = true; } if (GUI.Button(new Rect(offsetX, offsetY, 130, 30), "Height Map")) { textureToAlign = MGS._HeightMap; doStuff = true; } offsetY += 40; if (MGS._MetallicMap == null) { GUI.enabled = false; } else { GUI.enabled = true; } if (GUI.Button(new Rect(offsetX, offsetY, 130, 30), "Metallic Map")) { textureToAlign = MGS._MetallicMap; doStuff = true; } if (MGS._SmoothnessMap == null) { GUI.enabled = false; } else { GUI.enabled = true; } if (GUI.Button(new Rect(offsetX + 150, offsetY, 130, 30), "Smoothness Map")) { textureToAlign = MGS._SmoothnessMap; doStuff = true; } offsetY += 40; if (MGS._EdgeMap == null) { GUI.enabled = false; } else { GUI.enabled = true; } if (GUI.Button(new Rect(offsetX, offsetY, 130, 30), "Edge Map")) { textureToAlign = MGS._EdgeMap; doStuff = true; } if (MGS._AOMap == null) { GUI.enabled = false; } else { GUI.enabled = true; } if (GUI.Button(new Rect(offsetX + 150, offsetY, 130, 30), "AO Map")) { textureToAlign = MGS._AOMap; doStuff = true; } offsetY += 40; GUI.enabled = true; if (GuiHelper.Slider(new Rect(offsetX, offsetY, 280, 50), "Lens Distort Correction", LensDistort, LensDistortText, out LensDistort, out LensDistortText, -1.0f, 1.0f)) { doStuff = true; } offsetY += 40; if (GuiHelper.Slider(new Rect(offsetX, offsetY, 280, 50), "Perspective Correction X", PerspectiveX, PerspectiveXText, out PerspectiveX, out PerspectiveXText, -5.0f, 5.0f)) { doStuff = true; } offsetY += 40; if (GuiHelper.Slider(new Rect(offsetX, offsetY, 280, 50), "Perspective Correction Y", PerspectiveY, PerspectiveYText, out PerspectiveY, out PerspectiveYText, -5.0f, 5.0f)) { doStuff = true; } offsetY += 50; if (GUI.Button(new Rect(offsetX, offsetY, 130, 30), "Reset Points")) { pointTL = new Vector2(0.0f, 1.0f); pointTR = new Vector2(1.0f, 1.0f); pointBL = new Vector2(0.0f, 0.0f); pointBR = new Vector2(1.0f, 0.0f); } if (GUI.Button(new Rect(offsetX + 150, offsetY, 130, 30), "Set All Maps")) { StartCoroutine(SetMaps( )); } GUI.DragWindow(); }
/// <summary> /// Main Distributed scanning routine /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void btnScan_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBoxTarget.Text)) { lblStatus.Text = "Invalid IP/Url."; return; } string target = textBoxTarget.Text; if (!Helper.IsValidIPv4(target) && !Helper.IsValidUri(target)) { lblStatus.Text = "Invalid IP/Url."; return; } if (string.IsNullOrEmpty(textBoxStartPort.Text) || string.IsNullOrEmpty(textBoxEndPort.Text)) { lblStatus.Text = "Invalid port."; return; } int startPort = Convert.ToInt32(textBoxStartPort.Text); int endPort = Convert.ToInt32(textBoxEndPort.Text); if (startPort > endPort || endPort <= 0 || startPort <= 0 || startPort > PORT_MAX || endPort > PORT_MAX) { lblStatus.Text = "Invalid port."; return; } btnScan.Enabled = false; string windowTitle = "Open Ports ( " + target + " )"; RichTextBox rtb = GuiHelper.RichTextBoxDialog(windowTitle, string.Empty); int shellsCount = checkedListBoxShells.CheckedItems.Count; int portsPerShell = ((endPort - startPort) / shellsCount); int iter = 1; foreach (var checkedItem in checkedListBoxShells.CheckedItems) { string portsCode = string.Empty; string scannedRange = string.Empty; if (iter == shellsCount) { if (iter == 1) { scannedRange = startPort.ToString() + ", " + (endPort).ToString(); portsCode = "$ports = range(" + scannedRange + ");"; } else { scannedRange = (((iter - 1) * portsPerShell) + 1).ToString() + ", " + (endPort).ToString(); portsCode = "$ports = range(" + scannedRange + ");"; } } else { if (iter == 1) { scannedRange = startPort.ToString() + ", " + (iter * portsPerShell).ToString(); portsCode = "$ports = range(" + scannedRange + ");"; } else { scannedRange = (((iter - 1) * portsPerShell) + 1).ToString() + ", " + (iter * portsPerShell).ToString(); portsCode = "$ports = range(" + scannedRange + ");"; } iter++; } bool encryptResponse = true; string shellUrl = checkedListBoxShells.GetItemText(checkedItem); string responseText = "[" + shellUrl + "] - returned ports (" + scannedRange + ") - \r\n"; string phpCode = PhpBuilder.PortScanner(target, portsCode, encryptResponse); lblStatus.Text = "Scanning."; BantamMain.ExecutePHPCodeDisplayInRichTextBox(shellUrl, phpCode, windowTitle, encryptResponse, (int)CryptoHelper.RESPONSE_ENCRYPTION_TYPES.OPENSSL, false, rtb, responseText); btnScan.Enabled = true; } }
void OnGUI() { if (toggle.isOn) { if (ortho.isOn) { Matrix4x4 mvp = new Matrix4x4(); mvp.SetRow(0, new Vector4(Screen.width / 2f, 0f, 0f, (Screen.width - 1) / 2f)); mvp.SetRow(1, new Vector4(0f, Screen.height / 2f, 0f, (Screen.height - 1) / 2f)); mvp.SetRow(2, new Vector4(0f, 0f, 1f, 0f)); mvp.SetRow(3, new Vector4(0f, 0f, 0f, 1f)); Matrix4x4 morth = new Matrix4x4(); morth.SetRow(0, new Vector4(2f / (right_plane - left_plane), 0f, 0f, -((right_plane + left_plane) / (right_plane - left_plane)))); morth.SetRow(1, new Vector4(0f, 2f / (top_plane - bottom_plane), 0f, -((top_plane + bottom_plane) / (top_plane - bottom_plane)))); morth.SetRow(2, new Vector4(0f, 0f, 2f / (near_plane - far_plane), -((near_plane + far_plane) / (near_plane - far_plane)))); morth.SetRow(3, new Vector4(0f, 0f, 0f, 1f)); Matrix4x4 m = mvp * morth; for (int i = 0; i < world.lines.Length; i += 2) { Vector4 p = multiplyPoint(m, new Vector4(world.vertices[world.lines[i]].x, world.vertices[world.lines[i]].y, world.vertices[world.lines[i]].z, 1)); Vector4 q = multiplyPoint(m, new Vector4(world.vertices[world.lines[i + 1]].x, world.vertices[world.lines[i + 1]].y, world.vertices[world.lines[i + 1]].z, 1)); GuiHelper.DrawLine(new Vector2(p.x, p.y), new Vector2(q.x, q.y), Color.black); } } else { Vector3 w = -gaze.normalized; Vector3 u = Vector3.Cross(up, w).normalized; Vector3 v = Vector3.Cross(w, u); Matrix4x4 orthoMatrix = new Matrix4x4(); orthoMatrix.SetRow(0, new Vector4(2 / (right_plane - left_plane), 0, 0, -((right_plane + left_plane) / (right_plane - left_plane)))); orthoMatrix.SetRow(1, new Vector4(0, 2 / (top_plane - bottom_plane), 0, -((top_plane + bottom_plane) / (top_plane - bottom_plane)))); orthoMatrix.SetRow(2, new Vector4(0, 0, 2 / (near_plane - far_plane), -((near_plane + far_plane) / (near_plane - far_plane)))); orthoMatrix.SetRow(3, new Vector4(0, 0, 0, 1)); Matrix4x4 mvp = new Matrix4x4(); mvp.SetRow(0, new Vector4(Screen.width / 2, 0, 0, (Screen.width - 1) / 2)); mvp.SetRow(1, new Vector4(0, Screen.height / 2, 0, (Screen.height - 1) / 2)); mvp.SetRow(2, new Vector4(0, 0, 1, 0)); mvp.SetRow(3, new Vector4(0, 0, 0, 1)); Matrix4x4 mcam = new Matrix4x4(); mcam.SetRow(0, new Vector4(u.x, u.y, u.z, -((u.x * eye.x) + (u.y * eye.y) + (u.z * eye.z)))); mcam.SetRow(1, new Vector4(v.x, v.y, v.z, -((v.x * eye.x) + (v.y * eye.y) + (v.z * eye.z)))); mcam.SetRow(2, new Vector4(w.x, w.y, w.z, -((w.x * eye.x) + (w.y * eye.y) + (w.z * eye.z)))); mcam.SetRow(3, new Vector4(0, 0, 0, 1)); UpdateViewVolume(eye); Matrix4x4 mper = new Matrix4x4(); mper.SetRow(0, new Vector4((2 * near_plane) / (right_plane - left_plane), 0, (left_plane + right_plane) / (left_plane - right_plane), 0)); mper.SetRow(1, new Vector4(0, (2 * near_plane) / (top_plane - bottom_plane), (bottom_plane + top_plane) / (bottom_plane - top_plane), 0)); mper.SetRow(2, new Vector4(0, 0, (far_plane + near_plane) / (near_plane - far_plane), (2 * far_plane * near_plane) / (far_plane - near_plane))); mper.SetRow(3, new Vector4(0, 0, 1, 0)); float angle = fovAngle * Mathf.Deg2Rad; Matrix4x4 mper2 = new Matrix4x4(); mper2.SetRow(0, new Vector4(1 / (Mathf.Tan(angle) * aspect), 0, 0, 0)); mper2.SetRow(1, new Vector4(0, 1 / Mathf.Tan(angle), 0, 0)); mper2.SetRow(2, new Vector4(0, 0, (far_plane + near_plane) / (near_plane - far_plane), (2 * far_plane * near_plane) / (far_plane - near_plane))); mper2.SetRow(3, new Vector4(0, 0, 1, 0)); //Matrix4x4 final = mvp * ( mper * mcam); Matrix4x4 final = mvp * (mper2 * mcam); for (int i = 0; i < world.lines.Length; i += 2) { Vector4 p = multiplyPoint(final, new Vector4(world.vertices[world.lines[i]].x, world.vertices[world.lines[i]].y, world.vertices[world.lines[i]].z, 1)); Vector4 q = multiplyPoint(final, new Vector4(world.vertices[world.lines[i + 1]].x, world.vertices[world.lines[i + 1]].y, world.vertices[world.lines[i + 1]].z, 1)); GuiHelper.DrawLine(new Vector2(p.x / p.w, p.y / p.w), new Vector2(q.x / q.w, q.y / q.w), Color.black); } } } }
private void EhFileNamesMouseDoubleClick(object sender, MouseButtonEventArgs e) { GuiHelper.SynchronizeSelectionFromGui(_guiFileNames); BrowseSelectedFileName?.Invoke(); }
private void EhDateTimeFormatChanged(object sender, SelectionChangedEventArgs e) { GuiHelper.SynchronizeSelectionFromGui(_guiDateTimeFormats); }