Exemplo n.º 1
0
        public override void Initialize(ContentManager content)
        {
            m_Effect            = content.Load <Effect>("Shaders/PostProcessing/GlobalFog");
            m_SceneRenderTarget = GetRenderTarget();

            var renderer = Application.Engine.Renderer;

            if (renderer is ForwardRenderer)
            {
                var forward = (ForwardRenderer)renderer;
                forward.DepthRenderer.Enabled = true;
                m_DepthBuffer = forward.DepthRenderer._depthRT;
            }
            else if (renderer is DeferredRenderer)
            {
                var forward = (DeferredRenderer)renderer;
                m_DepthBuffer = forward.DepthBuffer;
            }
            else if (renderer is LightPrePassRenderer)
            {
                var lpp = (LightPrePassRenderer)renderer;
                m_DepthBuffer = lpp.DepthBuffer;
            }

            m_QuadRenderer = new QuadRenderer(m_GraphicsDevice);
        }
Exemplo n.º 2
0
        public override void Initialize(ContentManager content)
        {
            if (_graphicsDevice != null)
            {
                return;
            }

            _graphicsDevice = Application.GraphicsDevice;
            UpdateResolution(Screen.Width, Screen.Height);

            //if quadRenderer == null -> new, otherwise not
            _quadRenderer       = new QuadRenderer(_graphicsDevice);
            _renderTargetFormat = SurfaceFormat.Color;

            //Load the shader parameters and passes for cheap and easy access
            _bloomEffect = content.Load <Effect>("Shaders/PostProcessing/Bloom");
            _bloomInverseResolutionParameter = _bloomEffect.Parameters["InverseResolution"];
            _bloomRadiusParameter            = _bloomEffect.Parameters["Radius"];
            _bloomStrengthParameter          = _bloomEffect.Parameters["Strength"];
            _bloomStreakLengthParameter      = _bloomEffect.Parameters["StreakLength"];
            _bloomThresholdParameter         = _bloomEffect.Parameters["Threshold"];

            //For DirectX / Windows
            _bloomParameterScreenTexture = _bloomEffect.Parameters["ScreenTexture"];

            //If we are on OpenGL it's different, load the other one then!
            if (_bloomParameterScreenTexture == null)
            {
                //for OpenGL / CrossPlatform
                _bloomParameterScreenTexture = _bloomEffect.Parameters["LinearSampler+ScreenTexture"];
            }

            _bloomPassExtract           = _bloomEffect.Techniques["Extract"].Passes[0];
            _bloomPassExtractLuminance  = _bloomEffect.Techniques["ExtractLuminance"].Passes[0];
            _bloomPassDownsample        = _bloomEffect.Techniques["Downsample"].Passes[0];
            _bloomPassUpsample          = _bloomEffect.Techniques["Upsample"].Passes[0];
            _bloomPassUpsampleLuminance = _bloomEffect.Techniques["UpsampleLuminance"].Passes[0];

            //Default threshold.
            BloomThreshold = 0.2f;
            SetBloomPreset(BloomPreset);
        }
Exemplo n.º 3
0
 public override void Initialize(ContentManager content)
 {
     m_Effect            = content.Load <Effect>("Shaders/PostProcessing/FastBloom");
     m_SceneRenderTarget = GetRenderTarget();
     m_QuadRenderer      = new QuadRenderer(m_GraphicsDevice);
 }