Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ShadowMapTexture.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.Paradox.Effects.Modules.Renderers;
5 using SiliconStudio.Paradox.Engine;
6 using SiliconStudio.Paradox.Graphics;
7 
8 namespace SiliconStudio.Paradox.Effects.Modules.Processors
9 {
10  /// <summary>
11  /// Represents a texture to use with <see cref="ShadowMapRenderer"/>.
12  /// </summary>
13  public class ShadowMapTexture
14  {
15  public ShadowMapTexture(GraphicsDevice graphicsDevice, ShadowMapFilterType filterType, int shadowMapSize)
16  {
17  IsVarianceShadowMap = filterType == ShadowMapFilterType.Variance;
18 
19  if (filterType == ShadowMapFilterType.Variance)
20  {
21  ShadowMapDepthTexture = Texture2D.New(graphicsDevice, shadowMapSize, shadowMapSize, PixelFormat.D32_Float, TextureFlags.DepthStencil | TextureFlags.ShaderResource);
22  ShadowMapTargetTexture = Texture2D.New(graphicsDevice, shadowMapSize, shadowMapSize, PixelFormat.R32G32_Float, TextureFlags.RenderTarget | TextureFlags.ShaderResource);
23  ShadowMapRenderTarget = ShadowMapTargetTexture.ToRenderTarget();
24 
25  IntermediateBlurTexture = Texture2D.New(graphicsDevice, shadowMapSize, shadowMapSize, PixelFormat.R32G32_Float, TextureFlags.RenderTarget | TextureFlags.ShaderResource);
26  IntermediateBlurRenderTarget = IntermediateBlurTexture.ToRenderTarget();
27  }
28  else
29  ShadowMapDepthTexture = Texture2D.New(graphicsDevice, shadowMapSize, shadowMapSize, PixelFormat.D32_Float, TextureFlags.DepthStencil | TextureFlags.ShaderResource);
30 
31  ShadowMapDepthBuffer = ShadowMapDepthTexture.ToDepthStencilBuffer(false);
32  GuillotinePacker = new GuillotinePacker();
33  }
34 
35  internal Texture2D ShadowMapDepthTexture;
36  internal DepthStencilBuffer ShadowMapDepthBuffer;
37  internal GuillotinePacker GuillotinePacker;
38  internal bool IsVarianceShadowMap;
39 
40  // VSM only
41  internal Texture2D ShadowMapTargetTexture;
42  internal RenderTarget ShadowMapRenderTarget;
43  internal Texture2D IntermediateBlurTexture;
44  internal RenderTarget IntermediateBlurRenderTarget;
45  }
46 }
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.
A Texture 2D frontend to SharpDX.Direct3D11.Texture2D.
Definition: Texture2D.cs:37
Represents a texture to use with ShadowMapRenderer.
ShadowMapTexture(GraphicsDevice graphicsDevice, ShadowMapFilterType filterType, int shadowMapSize)