Ejemplo n.º 1
0
        private void ResizeRenderTarget(Viewport viewport)
        {
            int maxWidth  = viewport.Width;
            int maxHeight = viewport.Height;
            int maxTexDim = (_graphicsDevice.GraphicsProfile >= GraphicsProfile.HiDef) ? 4096 : 2048;

            maxWidth  = Math.Min(maxTexDim, maxWidth);
            maxHeight = Math.Min(maxTexDim, maxHeight);

            if (_renderTarget != null)
            {
                if (_renderTarget.Width == maxWidth && _renderTarget.Height == maxHeight)
                {
                    return;
                }
                if (!_renderTarget.IsDisposed)
                {
                    _renderTarget.Dispose();
                }
                _renderTarget = null;
            }
            if (_renderTarget == null)
            {
                _renderTarget = new RenderTarget2D(_graphicsDevice, maxWidth, maxHeight,
                                                   false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);

                if (fxaaGreenLumaLowEffect != null)
                {
                    fxaaGreenLumaLowEffect.SetDefaultParameters(maxWidth, maxHeight);
                }
                if (_graphicsDevice.GraphicsProfile >= GraphicsProfile.HiDef)
                {
                    fxaaGreenLumaMediumEffect.SetDefaultParameters(maxWidth, maxHeight);
                    fxaaGreenLumaHighEffect.SetDefaultParameters(maxWidth, maxHeight);
                }
            }
            return;
        }
Ejemplo n.º 2
0
 private void SetEffectParameters(FXAAEffect effect, float N, Viewport viewport)
 {
     effect.SetDefaultParameters(viewport.Width, viewport.Height);
     effect.AntialiasingEnabled = true;
 }