/// <summary>
        /// Basic PixelShaderPipeline
        /// </summary>
        /// <param name="graphicsDevice"></param>
        /// <param name="game"></param>
        public PixelShaderPipeline(GraphicsDevice graphicsDevice, Game game)
        {
            contentManager = new ContentManager(game.Services, "Content");
            effects = new List<IRenderEffect>();

            this.graphicsDevice = graphicsDevice;
            this.game = game;

            passTargetMap = new Dictionary<RenderPass, RenderTarget2D>();

            // Create a clone of the screen for each pass.
            // These must preserve contents, so that effects can use their own intermediate RenderTargets
            foreach (var pass in passes)
                passTargetMap.Add(pass, graphicsDevice.CreateFullscreenRenderTarget(true));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Load any required content the effect requires for rendering
        /// </summary>
        /// <param name="contentManager"></param>
        /// <param name="graphicsDevice"></param>
        /// <param name="spriteBatch"></param>
        public override void LoadContent(ContentManager contentManager, GraphicsDevice graphicsDevice, SpriteBatch spriteBatch)
        {
            reduceAlphaEffect = contentManager.Load<Effect>("Effects/Blur/ReduceAlpha");

            renderDimensions = new Vector2(graphicsDevice.PresentationParameters.BackBufferWidth,
                                           graphicsDevice.PresentationParameters.BackBufferHeight);

            previousFrame = graphicsDevice.CreateFullscreenRenderTarget(true);
            combineTarget = graphicsDevice.CreateFullscreenRenderTarget(false);

            base.LoadContent(contentManager, graphicsDevice, spriteBatch);
        }