Protogame.Default2DDirectRenderPass.BeginRenderPass C# (CSharp) Méthode

BeginRenderPass() public méthode

public BeginRenderPass ( IGameContext gameContext, IRenderContext renderContext, IRenderPass previousPass, RenderTarget2D postProcessingSource ) : void
gameContext IGameContext
renderContext IRenderContext
previousPass IRenderPass
postProcessingSource Microsoft.Xna.Framework.Graphics.RenderTarget2D
Résultat void
        public void BeginRenderPass(IGameContext gameContext, IRenderContext renderContext, IRenderPass previousPass, RenderTarget2D postProcessingSource)
        {
            // Setup the default sprite effect.
            var vp = Viewport ?? renderContext.GraphicsDevice.Viewport;

            Matrix projection;

            // Normal 3D cameras look into the -z direction (z = 1 is in font of z = 0). The
            // sprite batch layer depth is the opposite (z = 0 is in front of z = 1).
            // --> We get the correct matrix with near plane 0 and far plane -1.
            Matrix.CreateOrthographicOffCenter(0, vp.Width, vp.Height, 0, 0, -1, out projection);

            // Some platforms require a half pixel offset to match DX.
#if !PLATFORM_WINDOWS
            projection.M41 += -0.5f * projection.M11;
            projection.M42 += -0.5f * projection.M22;
#endif
            
            renderContext.View = Matrix.Identity;
            renderContext.Projection = projection;
            renderContext.World = Matrix.Identity;
        }
Default2DDirectRenderPass