private void stageDifSatTB_TextChanged(object sender, EventArgs e) { float i = 0; if (float.TryParse(stageDifSatTB.Text, out i)) { stageDifSatTB.BackColor = Color.White; selectedStageLight.setDifSaturation(i); } else { stageDifSatTB.BackColor = Color.Red; } UpdateStageButtonColor(); UpdateSliderFromValue(i, stageDifSatTrackBar, 1.0f); }
private void charColor1YTB_TextChanged(object sender, EventArgs e) { float i = 0; if (charLightsListBox.Items[charLightsListBox.SelectedIndex].ToString() == "Fresnel") { i = 0; if (float.TryParse(charColor1YTB.Text, out i)) { charColor1YTB.BackColor = Color.White; Lights.fresnelLight.setSkySaturation(i); } else { charColor1YTB.BackColor = Color.Red; } RenderCharacterLightColor(new Vector3(Lights.fresnelLight.skyR, Lights.fresnelLight.skyG, Lights.fresnelLight.skyB), new Vector3(Lights.fresnelLight.groundR, Lights.fresnelLight.groundG, Lights.fresnelLight.groundB)); } else if (charLightsListBox.Items[charLightsListBox.SelectedIndex].ToString().Contains("Diffuse")) { i = 0; if (float.TryParse(charColor1YTB.Text, out i)) { charColor1YTB.BackColor = Color.White; selectedCharDiffuseLight.setDifSaturation(i); } else { charColor1YTB.BackColor = Color.Red; } RenderCharacterLightColor(new Vector3(selectedCharDiffuseLight.difR, selectedCharDiffuseLight.difG, selectedCharDiffuseLight.difB), new Vector3(selectedCharDiffuseLight.ambR, selectedCharDiffuseLight.ambG, selectedCharDiffuseLight.ambB)); } UpdateSliderFromValue(i, charColor1YTrackBar, 1.0f); }
private void stageDifSatTB_TextChanged(object sender, EventArgs e) { float i = 0; if (float.TryParse(stageDifSatTB.Text, out i)) { stageDifSatTB.BackColor = Color.White; selectedStageLight.setDifSaturation(i); } else { stageDifSatTB.BackColor = Color.Red; } UpdateStageButtonColor(); int newSliderValue = (int)(selectedStageLight.difSaturation * (float)stageDifSatTrackBar.Maximum / 1.0f); newSliderValue = Math.Min(newSliderValue, stageDifSatTrackBar.Maximum); newSliderValue = Math.Max(newSliderValue, 0); stageDifSatTrackBar.Value = newSliderValue; }