private void OnApplyChangesClick(object sender, RoutedEventArgs e) { if (!IsValid(NSize) || !IsValid(MSize)) { MessageBox.Show("Please enter correct triangles' height and width (larger than 0)"); return; } appliedColorInfo = new FillColorInfo(FillColorInfo.Ks, FillColorInfo.Kd, FillColorInfo.M, FillColorInfo.ObjectColor, FillColorInfo.LightColor); appliedColorSettings = new FillColorSettings(FillColorSettings.KMSliders, FillColorSettings.NormalMap, FillColorSettings.InterpolMode, FillColorSettings.HybridMode, FillColorSettings.ColorFromTexture, FillColorSettings.MovingLight, FillColorSettings.NoGrid, FillColorSettings.Bubble); if (appliedColorSettings.NormalMap && NBitmap == null) { MessageBox.Show("No normal map chosen. Setting default normal map."); LoadNBitmap(Properties.Resources.Carpet_01_NRM); } if (appliedColorSettings.ColorFromTexture && ColBitmap == null) { MessageBox.Show("No color texture chosen. Setting default color texture."); LoadColBitmap(Properties.Resources.bloom_blooming_bright_1131407); } if (trianglesInfoChanged) { RepaintTriangles(true); } else { RepaintTriangles(false); } trianglesInfoChanged = false; }
public ScanlineRednering() { InitializeComponent(); FillColorInfo = new FillColorInfo(0.5, 0.5, 15, Colors.Red, Colors.White); FillColorInfo.PropertyChanged += FillColorInfo_PropertyChanged; appliedColorInfo = new FillColorInfo(0.5, 0.5, 1, Colors.Red, Colors.White); FillColorSettings = new FillColorSettings(false, true, false, false, true, false); appliedColorSettings = new FillColorSettings(false, true, false, false, true, false); TrianglesInfo = new TrianglesInfo("80", "60"); TrianglesInfo.PropertyChanged += TrianglesInfo_PropertyChanged; DispatcherTimer dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Tick += DispatcherTimer_Tick; dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 100); dispatcherTimer.Start(); }