/// <summary> /// Initializes a new instance of the <see cref="SkyDome"/> class. /// </summary> /// <param name="game">The game.</param> /// <param name="camera">The camera.</param> public SkyRenderer(Game game, Camera camera) { this.device = game.GraphicsDevice; parameters = new SkyRendererParameters(); this.camera = camera; fullscreenQuad = new QuadRenderer(game); game.Components.Add(fullscreenQuad); DomeN = 32; GeneratePermTex(); // You can use SurfaceFormat.Color to increase performance / reduce quality mieRT = new RenderTarget2D(device, 128, 64, false, SurfaceFormat.Color, DepthFormat.None); rayleighRT = new RenderTarget2D(device, 128, 64, false, SurfaceFormat.Color, DepthFormat.None); // Load Effects scatterEffect = game.Content.Load <Effect>("Shaders/Sky/scatter"); texturedEffect = game.Content.Load <Effect>("Shaders/Sky/Textured"); noiseEffect = game.Content.Load <Effect>("Shaders/Sky/SNoise"); // Load Textures moonTex = game.Content.Load <Texture2D>("Textures/moon"); glowTex = game.Content.Load <Texture2D>("Textures/moonglow"); starsTex = game.Content.Load <Texture2D>("Textures/starfield"); GenerateDome(); GenerateMoon(); }
/// <summary> /// Initializes a new instance of the <see cref="SSAORenderer"/> class. /// </summary> /// <param name="game">The game.</param> /// <param name="Width">The width.</param> /// <param name="Height">The height.</param> public SSAORenderer(Game game, int Width, int Height) { // Load SSAO effects ssaoEffect = game.Content.Load <Effect>("Shaders/SSAO/SSAO"); blurEffect = game.Content.Load <Effect>("Shaders/SSAO/Blur"); finalEffect = game.Content.Load <Effect>("Shaders/SSAO/Final"); // Create RenderTargets ssaoRT = new RenderTarget2D(game.GraphicsDevice, Width, Height, false, SurfaceFormat.Color, DepthFormat.None); blurRT = new RenderTarget2D(game.GraphicsDevice, Width, Height, false, SurfaceFormat.Color, DepthFormat.None); // Instantiate the GBuffer Texture Size gBufferTextureSize = new Vector2(Width, Height); // Instantiate the HalfPixel halfPixel = new Vector2() { X = 1.0f / Width, Y = 1.0f / Height }; // Instantiate the QuadRenderer fullscreenQuad = new QuadRenderer(game); game.Components.Add(fullscreenQuad); // Load the Random Normals Texture randomNormals = game.Content.Load <Texture2D>("Textures/RandomNormal"); }
/// <summary> /// Initializes the component. Override this method to load any non-graphics resources and query for any required services. /// </summary> public override void Initialize() { // Instantiate the QuadRenderer quadRenderer = new QuadRenderer(Game); Game.Components.Add(quadRenderer); base.Initialize(); }