private void BuildScene03() { var mesh = SurfaceExamples.NonConvexPlanar(); var sphere = MeshHelpers.Sphere(1); var meshes = new List <Mesh> { mesh, sphere }; BuildScene(meshes); Camera = new ArcBallCamera(new Vector3(20, 20, 20), Vector3.Zero, -MathHelper.Pi * 100, MathHelper.Pi * 100, 1, 1000, GraphicsDevice); }
private void myDrawingSurface_MouseMove(object sender, System.Windows.Input.MouseEventArgs e) { if (_isMouseDown) { var pos = e.GetPosition(sender as UIElement); if (_startDrag) { if (scene.Camera is ArcBallCamera) { ArcBallCamera abCamera = scene.Camera as ArcBallCamera; abCamera.Rotate(-(float)(pos.X - _mousePos.X) / 100f, -(float)(pos.Y - _mousePos.Y) / 100f); } else if (scene.Camera is ArcBallCamera1) { ArcBallCamera1 abCamera = scene.Camera as ArcBallCamera1; abCamera.Rotate(-(float)(pos.X - _mousePos.X) / 100f, -(float)(pos.Y - _mousePos.Y) / 100f); } else if (scene.Camera is FixAxisCamera) { FixAxisCamera abCamera = scene.Camera as FixAxisCamera; abCamera.Rotate(-(float)(pos.X - _mousePos.X) / 100f); } else if (scene.Camera is LevelCamera) { LevelCamera abCamera = scene.Camera as LevelCamera; abCamera.Rotate(-(float)(pos.X - _mousePos.X) / 100f); abCamera.Translate(new Microsoft.Xna.Framework.Vector3(0, 0, (float)(pos.Y - _mousePos.Y) / 10f)); } } else { _startDrag = true; } _mousePos = pos; } }