Ejemplo n.º 1
0
        internal void updateClip()
        {
            var rect = _graphicsDevice.ScissorRectangle;

            rect.X      = (int)(_clipRectangle.getX() * _scale.X - _translation.X);
            rect.Y      = (int)(_clipRectangle.getY() * _scale.Y - _translation.Y);
            rect.Width  = (int)(_clipRectangle.getWidth() * _scale.X);
            rect.Height = (int)(_clipRectangle.getHeight() * _scale.Y);
            _graphicsDevice.ScissorRectangle = rect;
        }
Ejemplo n.º 2
0
        public void setClip(Org.Mini2Dx.Core.Geom.Rectangle clip)
        {
            if (clip.getX() == 0 && clip.getY() == 0 && clip.getWidth() == getViewportWidth() &&
                clip.getHeight() == getViewportHeight())
            {
                removeClip();
                return;
            }

            var wasClipping = _rasterizerState.ScissorTestEnable;

            if (!_rasterizerState.ScissorTestEnable)
            {
                _rasterizerState = RasterizerClipping;
            }

            _clipRectangle = clip;
            updateClip();
            if (!wasClipping)
            {
                endRendering();
            }
        }