public GaussianBlur(GraphicsDevice graphicsDevice,
                     ContentManager Content, float BlurAmount) : base(Content.Load <Effect>
                                                                          ("GaussianBlur"), graphicsDevice)
 {
     this.blurAmount = BlurAmount;
     // Calculate weights/offsets for horizontal pass
     calcSettings(1.0f / (float)graphicsDevice.Viewport.Width, 0,
                  out weightsH, out offsetsH);
     // Calculate weights/offsets for vertical pass
     calcSettings(0, 1.0f / (float)graphicsDevice.Viewport.Height,
                  out weightsV, out offsetsV);
     capture = new RenderCapture(graphicsDevice);
 }
Exemple #2
0
        protected override void LoadContent()
        {
            renderCapture = new RenderCapture(GraphicsDevice);
            depthCapture  = new RenderCapture(GraphicsDevice);
            blurCapture   = new RenderCapture(GraphicsDevice);
            dof           = new DepthOfField(GraphicsDevice, Content);
            noPP          = new NullPostProcessor(GraphicsDevice, Content);
            gaussianPP    = new GaussianBlur(GraphicsDevice, Content, 2);
            grayscalePP   = new PostProcessor(Content.Load <Effect>("BlackAndWhite"), GraphicsDevice);
            depth         = new Shader(Content.Load <Effect>("DepthMap"));
            phong         = new Shader(Content.Load <Effect>("NoTexturePhong"));
            texPhong      = new Shader(Content.Load <Effect>("TexturePhong"));
            ocean         = new Shader(Content.Load <Effect>("OceanShader"));
            spriteBatch   = new SpriteBatch(GraphicsDevice);
            int screenWidth  = GraphicsDevice.PresentationParameters.BackBufferWidth;
            int screenHeight = GraphicsDevice.PresentationParameters.BackBufferHeight;

            renderTarget = new RenderTarget2D(GraphicsDevice, screenWidth, screenHeight, false,
                                              SurfaceFormat.Color, DepthFormat.Depth24);
        }