/// <summary>
        /// Adds the shadow map texture to the budget of textures.
        /// </summary>
        /// <param name="shadowMapTexture">The shadow map texture.</param>
        /// <param name="filterType">The filtering that will be applied to this shadow.</param>
        protected void AddShadowMapTexture(ShadowMapTexture shadowMapTexture, ShadowMapFilterType filterType)
        {
            if (filterType == ShadowMapFilterType.Variance)
            {
                texturesVsm.Add(shadowMapTexture, shadowMapTexture.ShadowMapDepthTexture.Width * shadowMapTexture.ShadowMapDepthTexture.Height);
                shadowMapVsmTextures.Add(shadowMapTexture);
            }
            else
            {
                texturesDefault.Add(shadowMapTexture, shadowMapTexture.ShadowMapDepthTexture.Width * shadowMapTexture.ShadowMapDepthTexture.Height);
                shadowMapDefaultTextures.Add(shadowMapTexture);
            }

            InternalShadowMapTextures.Add(shadowMapTexture);
        }
Пример #2
0
        public ShadowMapTexture(GraphicsDevice graphicsDevice, ShadowMapFilterType filterType, int shadowMapSize)
        {
            IsVarianceShadowMap = filterType == ShadowMapFilterType.Variance;

            if (filterType == ShadowMapFilterType.Variance)
            {
                ShadowMapDepthTexture = Texture.New2D(graphicsDevice, shadowMapSize, shadowMapSize, PixelFormat.D32_Float, TextureFlags.DepthStencil | TextureFlags.ShaderResource);
                ShadowMapTargetTexture = Texture.New2D(graphicsDevice, shadowMapSize, shadowMapSize, PixelFormat.R32G32_Float, TextureFlags.RenderTarget | TextureFlags.ShaderResource);

                IntermediateBlurTexture = Texture.New2D(graphicsDevice, shadowMapSize, shadowMapSize, PixelFormat.R32G32_Float, TextureFlags.RenderTarget | TextureFlags.ShaderResource);
            }
            else
                ShadowMapDepthTexture = Texture.New2D(graphicsDevice, shadowMapSize, shadowMapSize, PixelFormat.D32_Float, TextureFlags.DepthStencil | TextureFlags.ShaderResource);
            
            GuillotinePacker = new GuillotinePacker();
        }