Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
SkyboxRenderer.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 
4 using SiliconStudio.Core;
5 using SiliconStudio.Paradox.Graphics;
6 
7 namespace SiliconStudio.Paradox.Effects.Modules.Renderers
8 {
9  public class SkyboxRenderer : Renderer
10  {
11  private TextureCube skybox;
12 
13  private Effect skyboxEffect;
14 
15  public SkyboxRenderer(IServiceRegistry services, TextureCube skyboxTexture)
16  : base(services)
17  {
18  skybox = skyboxTexture;
19  }
20 
21  public override void Load()
22  {
23  base.Load();
24 
25  skyboxEffect = EffectSystem.LoadEffect("SkyboxShader");
26  skyboxEffect.Parameters.Set(TexturingKeys.TextureCube0, skybox);
27  }
28 
29  public override void Unload()
30  {
31  base.Unload();
32 
33  skyboxEffect.Dispose();
34  }
35 
36  protected override void OnRendering(RenderContext context)
37  {
38  GraphicsDevice.SetDepthStencilState(GraphicsDevice.DepthStencilStates.DepthRead);
39  skyboxEffect.Apply(context.CurrentPass.Parameters);
40  GraphicsDevice.DrawQuad();
41  }
42  }
43 }
SkyboxRenderer(IServiceRegistry services, TextureCube skyboxTexture)
A TextureCube frontend to SharpDX.Direct3D11.Texture2D.
Definition: TextureCube.cs:37
Performs render pipeline transformations attached to a specific RenderPass.
Definition: Renderer.cs:13
override void Unload()
Unloads this instance. This method is called when a RenderPass is de-attached (directly or indirectly...
A service registry is a IServiceProvider that provides methods to register and unregister services...
override void Load()
Loads this instance. This method is called when a RenderPass is attached (directly or indirectly) to ...
Thread-local storage context used during rendering.