/// <summary> /// Update viewport and rendertarget profiles for when window has been resized /// </summary> public void SetViewportSize(int viewportWidth, int viewportHeight) { Viewport viewport = graphicsDevice.Viewport; viewport.Width = Math.Max(1, viewportWidth); viewport.Height = Math.Max(1, viewportHeight); // Resize the viewport for newer render targets graphicsDevice.Viewport = viewport; // Reset the camera and render profile currentCamera.Initialize(viewportWidth, viewportHeight); currentRenderProfile.Initialize(); // Reset the profile inputs currentRenderProfile.MapInputs(); }
/// <summary> /// Update viewport and rendertarget profiles for when window has been resized /// </summary> public void SetViewportSize(int viewportWidth, int viewportHeight) { Viewport v = graphicsDevice.Viewport; v.Width = viewportWidth; v.Height = viewportHeight; graphicsDevice.Viewport = v; targetWidth = (float)graphicsDevice.Viewport.Width; targetHeight = (float)graphicsDevice.Viewport.Height; // Restart the render profile currentCamera.Initialize(targetWidth, targetHeight); currentRenderProfile.Initialize(); // Reset the inputs currentRenderProfile.MapInputs(currentScene, currentCamera); }