public Dof(SpriteBatch spriteBatch, Settings settings, Effect depthMapEffect, Effect dofEffect, Effect blurEffect) : base(spriteBatch) { if (settings == null) { throw new ArgumentNullException("settings"); } if (depthMapEffect == null) { throw new ArgumentNullException("depthMapEffect"); } if (dofEffect == null) { throw new ArgumentNullException("dofEffect"); } if (blurEffect == null) { throw new ArgumentNullException("blurEffect"); } this.settings = settings; //---------------------------------------------------------------- // エフェクト this.depthMapEffect = new DepthMapEffect(depthMapEffect); this.dofEffect = new DofEffect(dofEffect); //---------------------------------------------------------------- // レンダ ターゲット var pp = GraphicsDevice.PresentationParameters; var width = (int)(pp.BackBufferWidth * settings.MapScale); var height = (int)(pp.BackBufferHeight * settings.MapScale); // 深度マップ depthMap = new RenderTarget2D(GraphicsDevice, width, height, false, SurfaceFormat.Single, DepthFormat.Depth24, 0, RenderTargetUsage.DiscardContents); // ブラー済みシーン マップ bluredSceneMap = new RenderTarget2D(GraphicsDevice, width, height, false, SurfaceFormat.Color, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents); //---------------------------------------------------------------- // ブラー blur = new GaussianBlur(blurEffect, spriteBatch, width, height, SurfaceFormat.Color, settings.Blur.Radius, settings.Blur.Amount); }
public Dof(SpriteBatch spriteBatch, Settings settings, Effect depthMapEffect, Effect dofEffect, Effect blurEffect) : base(spriteBatch) { if (settings == null) throw new ArgumentNullException("settings"); if (depthMapEffect == null) throw new ArgumentNullException("depthMapEffect"); if (dofEffect == null) throw new ArgumentNullException("dofEffect"); if (blurEffect == null) throw new ArgumentNullException("blurEffect"); this.settings = settings; //---------------------------------------------------------------- // エフェクト this.depthMapEffect = new DepthMapEffect(depthMapEffect); this.dofEffect = new DofEffect(dofEffect); //---------------------------------------------------------------- // レンダ ターゲット var pp = GraphicsDevice.PresentationParameters; var width = (int) (pp.BackBufferWidth * settings.MapScale); var height = (int) (pp.BackBufferHeight * settings.MapScale); // 深度マップ depthMap = new RenderTarget2D(GraphicsDevice, width, height, false, SurfaceFormat.Single, DepthFormat.Depth24, 0, RenderTargetUsage.DiscardContents); // ブラー済みシーン マップ bluredSceneMap = new RenderTarget2D(GraphicsDevice, width, height, false, SurfaceFormat.Color, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents); //---------------------------------------------------------------- // ブラー blur = new GaussianBlur(blurEffect, spriteBatch, width, height, SurfaceFormat.Color, settings.Blur.Radius, settings.Blur.Amount); }