public Ssao(SpriteBatch spriteBatch, Settings settings, Effect normalDepthMapEffect, Effect ssaoMapEffect, Effect blurEffect, Effect ssaoEffect, Texture2D randomNormalMap) : base(spriteBatch) { if (settings == null) { throw new ArgumentNullException("settings"); } if (normalDepthMapEffect == null) { throw new ArgumentNullException("normalDepthMapEffect"); } if (ssaoMapEffect == null) { throw new ArgumentNullException("ssaoMapEffect"); } if (blurEffect == null) { throw new ArgumentNullException("blurEffect"); } if (ssaoEffect == null) { throw new ArgumentNullException("ssaoEffect"); } if (randomNormalMap == null) { throw new ArgumentNullException("randomNormalMap"); } this.settings = settings; this.spriteBatch = spriteBatch; var pp = GraphicsDevice.PresentationParameters; var width = (int)(pp.BackBufferWidth * settings.MapScale); var height = (int)(pp.BackBufferHeight * settings.MapScale); //---------------------------------------------------------------- // エフェクト // 法線深度マップ this.normalDepthMapEffect = new NormalDepthMapEffect(normalDepthMapEffect); // SSAO マップ this.ssaoMapEffect = new SsaoMapEffect(ssaoMapEffect); this.ssaoMapEffect.Initialize(width, height, randomNormalMap); // SSAO this.ssaoEffect = new SsaoEffect(ssaoEffect); //---------------------------------------------------------------- // レンダ ターゲット // 法線深度マップ normalDepthMap = new RenderTarget2D(GraphicsDevice, width, height, false, SurfaceFormat.Vector4, DepthFormat.Depth24, 0, RenderTargetUsage.DiscardContents); // SSAO マップ ssaoMap = new RenderTarget2D(GraphicsDevice, width, height, false, SurfaceFormat.Single, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents); //---------------------------------------------------------------- // SSAO マップブラー blur = new SsaoMapBlur(blurEffect, spriteBatch, width, height, SurfaceFormat.Single, settings.Blur.Radius, settings.Blur.Amount); }
public Ssao(SpriteBatch spriteBatch, Settings settings, Effect normalDepthMapEffect, Effect ssaoMapEffect, Effect blurEffect, Effect ssaoEffect, Texture2D randomNormalMap) : base(spriteBatch) { if (settings == null) throw new ArgumentNullException("settings"); if (normalDepthMapEffect == null) throw new ArgumentNullException("normalDepthMapEffect"); if (ssaoMapEffect == null) throw new ArgumentNullException("ssaoMapEffect"); if (blurEffect == null) throw new ArgumentNullException("blurEffect"); if (ssaoEffect == null) throw new ArgumentNullException("ssaoEffect"); if (randomNormalMap == null) throw new ArgumentNullException("randomNormalMap"); this.settings = settings; this.spriteBatch = spriteBatch; var pp = GraphicsDevice.PresentationParameters; var width = (int) (pp.BackBufferWidth * settings.MapScale); var height = (int) (pp.BackBufferHeight * settings.MapScale); //---------------------------------------------------------------- // エフェクト // 法線深度マップ this.normalDepthMapEffect = new NormalDepthMapEffect(normalDepthMapEffect); // SSAO マップ this.ssaoMapEffect = new SsaoMapEffect(ssaoMapEffect); this.ssaoMapEffect.Initialize(width, height, randomNormalMap); // SSAO this.ssaoEffect = new SsaoEffect(ssaoEffect); //---------------------------------------------------------------- // レンダ ターゲット // 法線深度マップ normalDepthMap = new RenderTarget2D(GraphicsDevice, width, height, false, SurfaceFormat.Vector4, DepthFormat.Depth24, 0, RenderTargetUsage.DiscardContents); // SSAO マップ ssaoMap = new RenderTarget2D(GraphicsDevice, width, height, false, SurfaceFormat.Single, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents); //---------------------------------------------------------------- // SSAO マップブラー blur = new SsaoMapBlur(blurEffect, spriteBatch, width, height, SurfaceFormat.Single, settings.Blur.Radius, settings.Blur.Amount); }