/// <summary> /// Main drawing function /// </summary> public override void Draw(GameTime gameTime) { List <RenderTarget2D> outputs = new List <RenderTarget2D>(); // Queue the render targets for each profile foreach (RenderProfile renderProfile in renderProfiles) { if (renderProfile != null) { renderProfile.Draw(currentScene, currentCamera); renderStats.GetSceneStats(currentScene); outputs.Add(renderProfile.Output); } } // Draw the final image graphicsDevice.SetRenderTarget(null); graphicsDevice.Clear(Color.Transparent); // Set final render target as a transparent layer spriteBatch.Begin(0, BlendState.NonPremultiplied, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); int splitType = outputs.Count; int splitID = 0; foreach (RenderTarget2D output in outputs) { spriteBatch.Draw(output, new Rectangle( (graphicsDevice.Viewport.Width / splitType) * splitID, 0, graphicsDevice.Viewport.Width / splitType, graphicsDevice.Viewport.Height), new Rectangle( (graphicsDevice.Viewport.Width / splitType) * splitID++, 0, graphicsDevice.Viewport.Width / splitType, graphicsDevice.Viewport.Height), Color.White); } spriteBatch.End(); if (rtIndex == 1) { DrawDebugData(); } if (debugText == true) { DrawDebugText(renderStats.frameRate, (int)renderStats.totalFrames); } base.Draw(gameTime); renderStats.Finish(); }
/// <summary> /// Main drawing function /// </summary> public override void Draw(GameTime gameTime) { RenderTarget2D output = null; // Draw the final image if (currentRenderProfile != null) { currentRenderProfile.Draw(gameTime); output = currentRenderProfile.Output; graphicsDevice.SetRenderTarget(null); graphicsDevice.Clear(Color.Transparent); spriteBatch.Begin(0, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); spriteBatch.Draw(output, new Rectangle(0, 0, (int)targetWidth, (int)targetHeight), Color.White); spriteBatch.End(); /// Setup for bounding boxes sceneRenderer.DrawBoundingBoxes(currentScene, this.currentCamera); } if (rtIndex == 1) { DrawDebugData(); } if (debugText == true) { DrawDebugText(renderStats.frameRate, (int)renderStats.totalFrames); } base.Draw(gameTime); renderStats.Finish(); }