public WaveGridWindow() { InitializeComponent(); _grid = new WaveGrid(GridSize); // 10x10 grid slidPeakHeight.Value = _firstPeak; _grid.SetCenterPeak(_firstPeak); meshMain.Positions = _grid.Points; meshMain.TriangleIndices = _grid.TriangleIndices; // On each WheelMouse change, we zoom in/out a particular % of the original distance const double ZoomPctEachWheelChange = 0.02; zoomDelta = Vector3D.Multiply(ZoomPctEachWheelChange, camMain.LookDirection); }
// Start/stop animation private void btnStart_Click(object sender, RoutedEventArgs e) { if (!_rendering) { _grid = new WaveGrid(GridSize); // 10x10 grid _grid.SetCenterPeak(_firstPeak); meshMain.Positions = _grid.Points; _lastTimeRendered = 0.0; CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering); btnStart.Content = "Stop"; slidPeakHeight.IsEnabled = false; _rendering = true; } else { CompositionTarget.Rendering -= new EventHandler(CompositionTarget_Rendering); btnStart.Content = "Start"; slidPeakHeight.IsEnabled = true; _rendering = false; } }
private void slidPeakHeight_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { _firstPeak = slidPeakHeight.Value; _grid.SetCenterPeak(_firstPeak); }