public void ExecutePostProcessPass(ITexture frameColorTexture, ITexture frameDepthTexture, ref Point actualScreenRezolution)
        {
            ITexture subsequentPostProcessResult = null;

            if (bPostProcessEnabled)
            {
                // DoF
                if (depthOfFieldPP != null)
                {
                    subsequentPostProcessResult = depthOfFieldPP.GetPostProcessResult(frameColorTexture, frameDepthTexture, actualScreenRezolution, null);
                }

                // Bloom
                if (bloomPP != null)
                {
                    subsequentPostProcessResult = bloomPP.GetPostProcessResult(frameColorTexture, frameDepthTexture, actualScreenRezolution, subsequentPostProcessResult);
                }

                // Light shafts
                if (lightShaftsPP != null && GameWorld.GetWorldInstance().GetLevel().SunRenderer.GetData().IsInCameraView)
                {
                    subsequentPostProcessResult = lightShaftsPP.GetPostProcessResult(frameColorTexture, frameDepthTexture, actualScreenRezolution, subsequentPostProcessResult);
                }

                // Lens flares
                if (lensFlaresPP != null && GameWorld.GetWorldInstance().GetLevel().SunRenderer.GetData().IsInCameraView)
                {
                    subsequentPostProcessResult = lensFlaresPP.GetPostProcessResult(frameColorTexture, frameDepthTexture, actualScreenRezolution, subsequentPostProcessResult);
                }
            }

            // Resolve post process result texture or default color texture to default framebuffer
            if (subsequentPostProcessResult != null)
            {
                if (depthOfFieldPP == null)
                {
                    TextureResolver.ResolvePostProcessResultToDefaultFramebuffer(frameColorTexture, subsequentPostProcessResult, actualScreenRezolution);
                }
                else
                {
                    GameWorld.GetWorldInstance().GetUiFrameCreator().RenderFullScreenInputTexture(subsequentPostProcessResult, actualScreenRezolution);
                }
            }
            else
            {
                GameWorld.GetWorldInstance().GetUiFrameCreator().RenderFullScreenInputTexture(frameColorTexture, actualScreenRezolution);
            }
        }
Ejemplo n.º 2
0
        public MineFieldRenderer(MineField mineField, GraphicsDevice graphicsDevice, Texture2D tileSet)
        {
            MineField        = mineField;
            GraphicsDevice   = graphicsDevice;
            _tileSet         = tileSet;
            _textureResolver = new TextureResolver(tileSet, MineField.CellSize, MineField.CellSize);

            RenderTarget = new RenderTarget2D(
                GraphicsDevice,
                mineField.Width * mineField.CellSize,
                mineField.Height * mineField.CellSize,
                true,
                GraphicsDevice.PresentationParameters.BackBufferFormat,
                DepthFormat.Depth24
                );

            _spriteBatch = new SpriteBatch(GraphicsDevice);

            MineField.Changed += (sender, args) => Render();
        }