Windows/WaveGridWindow.xaml.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using MahAppsMetro.Demo.Views;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Shapes;
namespace MahAppsMetro.Demo.Windows
{
/// <summary>
/// Interaction logic for WaveGridWindow.xaml
/// </summary>
public partial class WaveGridWindow : Window
{
private Vector3D zoomDelta;
private WaveGrid _grid;
private bool _rendering;
private double _lastTimeRendered;
private double _firstPeak = 6.5;
// Values to try:
// GridSize=20, RenderPeriod=125
// GridSize=50, RenderPeriod=50
private const int GridSize = 50;
private const double RenderPeriodInMS = 50;
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);
}
private void Window_MouseWheel(object sender, MouseWheelEventArgs e)
{
if (e.Delta > 0)
// Zoom in
camMain.Position = Point3D.Add(camMain.Position, zoomDelta);
else
// Zoom out
camMain.Position = Point3D.Subtract(camMain.Position, zoomDelta);
后面还有 53 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。