private void stageDifIntensityTB_TextChanged(object sender, EventArgs e) { float i = 0; if (float.TryParse(stageDifIntensityTB.Text, out i)) { stageDifIntensityTB.BackColor = Color.White; selectedStageLight.setDifIntensity(i); } else { stageDifIntensityTB.BackColor = Color.Red; } UpdateStageButtonColor(); UpdateSliderFromValue(i, stageDifIntensityTrackBar, 5.0f); }
private void charColor1ZTB_TextChanged(object sender, EventArgs e) { float i = 0; if (charLightsListBox.Items[charLightsListBox.SelectedIndex].ToString() == "Fresnel") { i = 0; if (float.TryParse(charColor1ZTB.Text, out i)) { charColor1ZTB.BackColor = Color.White; Lights.fresnelLight.setSkyIntensity(i); } else { charColor1ZTB.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(charColor1ZTB.Text, out i)) { charColor1ZTB.BackColor = Color.White; selectedCharDiffuseLight.setDifIntensity(i); } else { charColor1ZTB.BackColor = Color.Red; } RenderCharacterLightColor(new Vector3(selectedCharDiffuseLight.difR, selectedCharDiffuseLight.difG, selectedCharDiffuseLight.difB), new Vector3(selectedCharDiffuseLight.ambR, selectedCharDiffuseLight.ambG, selectedCharDiffuseLight.ambB)); } UpdateSliderFromValue(i, charColor1ZTrackBar, 5.0f); }
private void stageDifIntensityTB_TextChanged(object sender, EventArgs e) { float i = 0; if (float.TryParse(stageDifIntensityTB.Text, out i)) { stageDifIntensityTB.BackColor = Color.White; selectedStageLight.setDifIntensity(i); } else { stageDifIntensityTB.BackColor = Color.Red; } UpdateStageButtonColor(); int newSliderValue = (int)(selectedStageLight.difIntensity * (float)stageDifIntensityTrackBar.Maximum / 5.0f); newSliderValue = Math.Min(newSliderValue, stageDifIntensityTrackBar.Maximum); newSliderValue = Math.Max(newSliderValue, 0); stageDifIntensityTrackBar.Value = newSliderValue; }