protected override void Update(GameTime gameTime) { _orbitCamera.SetAspectRatio((float)GraphicsDevice.Viewport.Width / (float)GraphicsDevice.Viewport.Height); // Get the current state of the keyboard var keyboardState = _keyboardManager.GetState(); if (keyboardState.IsKeyPressed(Keys.Escape)) { Exit(); } var time = (float)gameTime.ElapsedGameTime.TotalSeconds; _orbitCamera.Target = new SharpDX.Vector3(CenterX, CenterY, CenterZ); if (Animate) { _orbitCamera.Rotation = (float)(Math.PI * (0.2 * Math.Sin(0.23 * gameTime.TotalGameTime.TotalSeconds))); _orbitCamera.UpDown = (float)(Math.PI * (0.1 * Math.Sin(0.11 * gameTime.TotalGameTime.TotalSeconds))); } if (keyboardState.IsKeyDown(Keys.A)) { _orbitCamera.Left((float)gameTime.ElapsedGameTime.TotalSeconds); } if (keyboardState.IsKeyDown(Keys.D)) { _orbitCamera.Right((float)gameTime.ElapsedGameTime.TotalSeconds); } if (keyboardState.IsKeyDown(Keys.W)) { _orbitCamera.Up((float)gameTime.ElapsedGameTime.TotalSeconds); } if (keyboardState.IsKeyDown(Keys.S)) { _orbitCamera.Down((float)gameTime.ElapsedGameTime.TotalSeconds); } if (keyboardState.IsKeyDown(Keys.E)) { _orbitCamera.ZoomIn((float)gameTime.ElapsedGameTime.TotalSeconds); } if (keyboardState.IsKeyDown(Keys.C)) { _orbitCamera.ZoomOut((float)gameTime.ElapsedGameTime.TotalSeconds); } // Update renderers to manipulator view foreach (var g in _geometryRenderers) { g.View = _orbitCamera.View; g.Projection = _orbitCamera.Projection; g.ClipZone = new SharpDX.Vector4(CenterX, CenterY, CenterZ, Radius); g.ClipFloor = Floor; g.ClipCeiling = Ceiling; g.Holographic = HologramEnabled; } base.Update(gameTime); }