コード例 #1
0
        protected override void LoadContent()
        {
            var pp = GraphicsDevice.PresentationParameters;
            var width = (int) (pp.BackBufferWidth * Settings.MapScale);
            var height = (int) (pp.BackBufferHeight * Settings.MapScale);

            #region Effects

            normalDepthMapEffect = EffectManager.Load<NormalDepthMapEffect>();
            edgeDetectionEffect = EffectManager.Load<EdgeDetectionEffect>();
            edgeDetectionEffect.SetEdgeWidth(Settings.EdgeWidth);
            edgeDetectionEffect.SetMapSize(width, height);

            #endregion

            #region Back buffers

            normalDepthMapBackBuffer = BackBufferManager.Load("NormalDepthMap");
            normalDepthMapBackBuffer.Width = width;
            normalDepthMapBackBuffer.Height = height;
            normalDepthMapBackBuffer.MipMap = false;
            normalDepthMapBackBuffer.SurfaceFormat = normalDepthMapFormat;
            normalDepthMapBackBuffer.MultiSampleCount = 0;
            normalDepthMapBackBuffer.Enabled = Enabled;

            #endregion

            base.LoadContent();
        }
コード例 #2
0
ファイル: Ssao.cs プロジェクト: willcraftia/WindowsGame
        protected override void LoadContent()
        {
            #region Effects

            normalDepthMapEffect = EffectManager.Load<NormalDepthMapEffect>();
            ssaoMapEffect = EffectManager.Load<SsaoMapEffect>();
            ssaoMapBlurEffect = EffectManager.Load<SsaoMapBlurEffect>();
            ssaoEffect = EffectManager.Load<SsaoEffect>();

            var randomNormalMap = Content.Load<Texture2D>("Textures/RandomNormal");
            ssaoMapEffect.SetRandomNormalMap(randomNormalMap);

            #endregion

            #region Back buffers

            const int normalDepthMapSampleQuality = 0;

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

            normalDepthMapBackBuffer = BackBufferManager.Load("NormalDepthmap");
            normalDepthMapBackBuffer.Width = width;
            normalDepthMapBackBuffer.Height = height;
            normalDepthMapBackBuffer.MipMap = false;
            normalDepthMapBackBuffer.SurfaceFormat = normalDepthMapFormat;
            normalDepthMapBackBuffer.DepthFormat = DepthFormat.Depth24Stencil8;
            normalDepthMapBackBuffer.MultiSampleCount = normalDepthMapSampleQuality;
            normalDepthMapBackBuffer.Enabled = Enabled;

            ssaoMapBackBuffer = BackBufferManager.Load("SsaoMap");
            ssaoMapBackBuffer.Width = width;
            ssaoMapBackBuffer.Height = height;
            ssaoMapBackBuffer.MipMap = false;
            ssaoMapBackBuffer.SurfaceFormat = SurfaceFormat.Color;
            ssaoMapBackBuffer.DepthFormat = DepthFormat.Depth24Stencil8;
            ssaoMapBackBuffer.MultiSampleCount = 0;
            ssaoMapBackBuffer.Enabled = Enabled;

            ssaoMapBlurBackBuffer = BackBufferManager.Load("SsaoGaussianBlur");
            ssaoMapBlurBackBuffer.Width = width;
            ssaoMapBlurBackBuffer.Height = height;
            ssaoMapBlurBackBuffer.MipMap = false;
            ssaoMapBlurBackBuffer.SurfaceFormat = SurfaceFormat.Color;
            ssaoMapBlurBackBuffer.DepthFormat = DepthFormat.Depth24Stencil8;
            ssaoMapBlurBackBuffer.MultiSampleCount = 0;
            ssaoMapBlurBackBuffer.Enabled = Enabled;

            #endregion

            base.LoadContent();
        }