/// <summary> /// Draw the current state of the background screen. /// </summary> /// <param name="gameTime">Current time of the game.</param> public override void Draw(GameTime gameTime) { Viewport viewport = EngineManager.GameGraphicsDevice.Viewport; // Change the RenderTarget to the render capture to draw the model renderCapture.BeginRender(); GameGraphicsDevice.Clear(Color.Transparent); GameGraphicsDevice.DepthStencilState = DepthStencilState.Default; GameGraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap; GameGraphicsDevice.BlendState = BlendState.AlphaBlend; GameGraphicsDevice.DepthStencilState = DepthStencilState.Default; _model.Draw(CameraManager.ActiveCamera.View, CameraManager.ActiveCamera.Projection, DrawingMethod.NoInstancing, _individualTransformations, null); postProcessor.Input = renderCapture.GetTexture(); // Aply the post processing effect renderCapture.InitEffect(); postProcessor.Draw(); renderCapture.EndEffect(); renderCapture.EndRender(); // Draw the background image ScreenManager.SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, CanvasManager.ScaleMatrix); ScreenManager.SpriteBatch.Draw(TextureManager.GetTexture(backgroundTexture).BaseTexture as Texture2D, new Rectangle(0, 0, GameSettings.DefaultInstance.ResolutionWidth, GameSettings.DefaultInstance.ResolutionHeight), new Color(TransitionAlpha, TransitionAlpha, TransitionAlpha)); // Draw the title ScreenManager.SpriteBatch.DrawString(ScreenManager.FontTitle, _menuTitle, _titlePosition, Color.White); ScreenManager.SpriteBatch.Draw(TextureManager.GetTexture("SeparationBar").BaseTexture, new Rectangle((int)_titlePosition.X, (int)(_titlePosition.Y + _titleSize.Y), (int)_titleSize.X, 5), Color.White); ScreenManager.SpriteBatch.End(); // Join the background and the model ScreenManager.SpriteBatch.Begin(); if (GameSettings.DefaultInstance.HighDetail) { ScreenManager.SpriteBatch.Draw(renderCapture._finalTarget, new Rectangle(0, 0, viewport.Width, viewport.Height), Color.White); } else { ScreenManager.SpriteBatch.Draw(renderCapture._renderTarget, new Rectangle(0, 0, viewport.Width, viewport.Height), Color.White); } ScreenManager.SpriteBatch.End(); base.Draw(gameTime); }
public static void Draw(Texture2D screen, PostProcessor postProcessingEffect) { postProcessingEffect.Draw(screen); }