Exemplo n.º 1
0
        public ThreadedFrameBuffer(ThreadedGraphicsContext device, IFrameBuffer frameBuffer)
        {
            this.device = device;
            getTexture  = () => frameBuffer.Texture;
            bind        = frameBuffer.Bind;
            unbind      = frameBuffer.Unbind;
            dispose     = frameBuffer.Dispose;

            enableScissor  = rect => frameBuffer.EnableScissor((Rectangle)rect);
            disableScissor = frameBuffer.DisableScissor;
        }
Exemplo n.º 2
0
        public void EnableScissor(Rectangle rect)
        {
            // Must remain inside the current scissor rect
            if (scissorState.Any())
            {
                rect = Rectangle.Intersect(rect, scissorState.Peek());
            }

            Flush();

            if (renderType == RenderType.World)
            {
                worldBuffer.EnableScissor(rect);
            }
            else
            {
                Context.EnableScissor(rect.X, rect.Y, rect.Width, rect.Height);
            }

            scissorState.Push(rect);
        }