/// <summary> /// Rotate the view /// </summary> /// <param name="deltaX"></param> /// <param name="deltaY"></param> private void DoRotate(double deltaX, double deltaY) { Theta -= deltaX / this.ActualWidth * 180.0; Phi -= deltaY / this.ActualHeight * 90.0; if (Theta < 0) { Theta += 360; } else if (Theta > 360) { Theta -= 360; } if (Phi < 0.01) { Phi = 0.01; } else if (Phi > 179.99) { Phi = 179.99; } _camera.LookDirection = GeomTools.CalcNormal(GeomTools.Deg2Rad(Theta), GeomTools.Deg2Rad(Phi)); }
/// <summary> /// Constructor /// </summary> public DormViewCtrl() { InitializeComponent(); _sphereMesh = GeomTools.CreateSphereMesh(40, 20, 10); // Initialize background with no image _textureBrush = new ImageBrush(); _textureBrush.TileMode = TileMode.Tile; }