6 using SiliconStudio.Core;
7 using SiliconStudio.Core.Mathematics;
8 using SiliconStudio.Core.Serialization.Assets;
9 using SiliconStudio.Paradox.Graphics;
11 namespace SiliconStudio.
Paradox.Effects
32 : this(services, null)
45 if (!
string.IsNullOrEmpty(backgroundTexturePath))
48 BackgroundTexture = assetManager.Load<
Texture2D>(backgroundTexturePath);
56 if(BackgroundTexture == null)
61 var imageBufferMinRatio = Math.Min(BackgroundTexture.Width / (float)
GraphicsDevice.
BackBuffer.
Width, BackgroundTexture.Height / (
float)GraphicsDevice.BackBuffer.Height);
63 var source =
new Rectangle((BackgroundTexture.Width - sourceSize.X) / 2, (BackgroundTexture.Height - sourceSize.Y) / 2, sourceSize.X, sourceSize.Y);
65 spriteBatch.Begin(SpriteSortMode.FrontToBack, GraphicsDevice.BlendStates.Opaque, GraphicsDevice.SamplerStates.LinearClamp, GraphicsDevice.DepthStencilStates.None);
66 spriteBatch.Draw(BackgroundTexture, destination, source, Color.White, 0, Vector2.Zero, SpriteEffects.None, ImageOrientation.AsIs, 0);
70 GraphicsDevice.SetBlendState(null);
71 GraphicsDevice.SetRasterizerState(null);
72 GraphicsDevice.SetDepthStencilState(null);
RenderTarget BackBuffer
Gets the back buffer sets by the current Presenter setup on this device.
Performs render pipeline transformations attached to a specific RenderPass.
Interface of the asset manager.
This renderer draws a full-screen image as background. The ratio or the texture used is preserved...
A service registry is a IServiceProvider that provides methods to register and unregister services...
Performs primitive-based rendering, creates resources, handles system-level variables, adjusts gamma ramp levels, and creates shaders. See The+GraphicsDevice+class to learn more about the class.
int Width
Gets the width in texel.
Thread-local storage context used during rendering.
A Texture 2D frontend to SharpDX.Direct3D11.Texture2D.
int Height
Gets the height in texel.
System.Windows.Shapes.Rectangle Rectangle
Represents a three dimensional mathematical vector.
Renders a group of sprites.
BackgroundRenderer(IServiceRegistry services)
Initializes a new instance of the BackgroundRenderer with null texture.
SiliconStudio.Core.Mathematics.RectangleF RectangleF
override void OnRendering(RenderContext context)
BackgroundRenderer(IServiceRegistry services, string backgroundTexturePath)
Initializes a new instance of the BackgroundRenderer using the provided file as background texture...