示例#1
0
        public Edge(SpriteBatch spriteBatch, Settings settings, Effect normalDepthMapEffect, Effect edgeEffect)
            : base(spriteBatch)
        {
            if (settings == null) throw new ArgumentNullException("settings");
            if (normalDepthMapEffect == null) throw new ArgumentNullException("normalDepthMapEffect");
            if (edgeEffect == null) throw new ArgumentNullException("edgeEffect");

            this.settings = settings;

            var pp = GraphicsDevice.PresentationParameters;
            var width = (int) (pp.BackBufferWidth * settings.MapScale);
            var height = (int) (pp.BackBufferHeight * settings.MapScale);

            //----------------------------------------------------------------
            // エフェクト

            // 法線深度マップ
            this.normalDepthMapEffect = new NormalDepthMapEffect(normalDepthMapEffect);

            // エッジ強調
            this.edgeEffect = new EdgeEffect(edgeEffect);
            this.edgeEffect.MapWidth = width;
            this.edgeEffect.MapHeight = height;

            //----------------------------------------------------------------
            // レンダ ターゲット

            normalDepthMap = new RenderTarget2D(GraphicsDevice, width, height,
                false, SurfaceFormat.Vector4, DepthFormat.Depth24, 0, RenderTargetUsage.DiscardContents);
        }
示例#2
0
        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);
        }
示例#3
0
        public Edge(SpriteBatch spriteBatch, Settings settings, Effect normalDepthMapEffect, Effect edgeEffect)
            : base(spriteBatch)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (normalDepthMapEffect == null)
            {
                throw new ArgumentNullException("normalDepthMapEffect");
            }
            if (edgeEffect == null)
            {
                throw new ArgumentNullException("edgeEffect");
            }

            this.settings = settings;

            var pp     = GraphicsDevice.PresentationParameters;
            var width  = (int)(pp.BackBufferWidth * settings.MapScale);
            var height = (int)(pp.BackBufferHeight * settings.MapScale);

            //----------------------------------------------------------------
            // エフェクト

            // 法線深度マップ
            this.normalDepthMapEffect = new NormalDepthMapEffect(normalDepthMapEffect);

            // エッジ強調
            this.edgeEffect           = new EdgeEffect(edgeEffect);
            this.edgeEffect.MapWidth  = width;
            this.edgeEffect.MapHeight = height;

            //----------------------------------------------------------------
            // レンダ ターゲット

            normalDepthMap = new RenderTarget2D(GraphicsDevice, width, height,
                                                false, SurfaceFormat.Vector4, DepthFormat.Depth24, 0, RenderTargetUsage.DiscardContents);
        }
示例#4
0
        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);
        }