示例#1
0
        public void BeginUI()
        {
            if (renderType == RenderType.World)
            {
                // Complete world rendering
                Flush();
                worldBuffer.Unbind();

                // Render the world buffer into the UI buffer
                screenBuffer.Bind();

                var scale      = Window.EffectiveWindowScale;
                var bufferSize = new Size((int)(screenSprite.Bounds.Width / scale), (int)(-screenSprite.Bounds.Height / scale));

                SpriteRenderer.SetAntialiasingPixelsPerTexel(Window.SurfaceSize.Height * 1f / worldSprite.Bounds.Height);
                RgbaSpriteRenderer.DrawSprite(worldSprite, float3.Zero, new float2(bufferSize));
                Flush();
                SpriteRenderer.SetAntialiasingPixelsPerTexel(0);
            }
            else
            {
                // World rendering was skipped
                BeginFrame();
                screenBuffer.Bind();
            }

            renderType = RenderType.UI;
        }
示例#2
0
        public void EndFrame(IInputHandler inputHandler)
        {
            Flush();

            screenBuffer.Unbind();

            // Render the compositor buffer to the screen
            // HACK / PERF: Fudge the coordinates to cover the actual window while keeping the buffer viewport parameters
            // This saves us two redundant (and expensive) SetViewportParams each frame
            RgbaSpriteRenderer.DrawSprite(screenSprite, new float3(0, lastBufferSize.Height, 0), new float3(lastBufferSize.Width, -lastBufferSize.Height, 0));
            Flush();

            Window.PumpInput(inputHandler);
            Context.Present();
        }
示例#3
0
        public void EndFrame(IInputHandler inputHandler)
        {
            if (renderType != RenderType.UI)
            {
                throw new InvalidOperationException("EndFrame called with renderType = {0}, expected RenderType.UI.".F(renderType));
            }

            Flush();

            screenBuffer.Unbind();

            // Render the compositor buffers to the screen
            // HACK / PERF: Fudge the coordinates to cover the actual window while keeping the buffer viewport parameters
            // This saves us two redundant (and expensive) SetViewportParams each frame
            RgbaSpriteRenderer.DrawSprite(screenSprite, new float3(0, lastBufferSize.Height, 0), new float3(lastBufferSize.Width, -lastBufferSize.Height, 0));
            Flush();

            Window.PumpInput(inputHandler);
            Context.Present();

            renderType = RenderType.None;
        }
 void DisableFrameBuffer(IFrameBuffer fbo)
 {
     Game.Renderer.Flush();
     Game.Renderer.Context.DisableDepthBuffer();
     fbo.Unbind();
 }
示例#5
0
 void DisableFrameBuffer(IFrameBuffer fbo)
 {
     WarGame.Renderer.Flush();
     WarGame.Renderer.Device.DisableDepthBuffer();
     fbo.Unbind();
 }
示例#6
0
 void DisableFrameBuffer(IFrameBuffer fbo)
 {
     Game.Renderer.Flush();
     Game.Renderer.Device.DisableDepthBuffer();
     fbo.Unbind();
 }