public virtual void BeginRenderPass(IGameContext gameContext, IRenderContext renderContext, IRenderPass previousPass, RenderTarget2D postProcessingSource) { _interlacedBatchingDepthProvider.Reset(); if (Viewport != null) { renderContext.GraphicsDevice.Viewport = Viewport.Value; } else { var size = _backBufferDimensions.GetSize(renderContext.GraphicsDevice); renderContext.GraphicsDevice.Viewport = new Viewport( 0, 0, size.Width, size.Height); } #if PLATFORM_WINDOWS renderContext.World = Matrix.CreateTranslation(0.5f, 0.5f, 0); #else renderContext.World = Matrix.Identity; #endif renderContext.Projection = Matrix.CreateOrthographicOffCenter( 0, renderContext.GraphicsDevice.Viewport.Width, renderContext.GraphicsDevice.Viewport.Height, 0, 0, -1); renderContext.View = Matrix.Identity; renderContext.SpriteBatch.Begin(TextureSortMode); }
public void BeginRenderPass(IGameContext gameContext, IRenderContext renderContext, IRenderPass previousPass, RenderTarget2D postProcessingSource) { _interlacedBatchingDepthProvider.Reset(); // 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; }
public void BeginRenderPass(IGameContext gameContext, IRenderContext renderContext, IRenderPass previousPass, RenderTarget2D postProcessingSource) { _interlacedBatchingDepthProvider.Reset(); renderContext.SpriteBatch.Begin(TextureSortMode, transformMatrix: TransformMatrix); }