예제 #1
0
파일: Pipeline.cs 프로젝트: liwq-net/XnaVG
        internal void StencilGlyph(IRenderable path, ref Vector2 offset)
        {
            var effect = Device.EffectManager.StencilFill;
            effect.SetPathOffset(ref offset);

            // Render mesh
            if (path.HasFill)
            {
                path.BeforeRenderFill();
                if (State.Antialiasing == VGAntialiasing.None)
                {
                    effect.Apply();
                    path.RenderFill();
                }
                else
                    for (int samples = (int)State.Antialiasing - 1, MSAAMask = _msaaMasks[State.Antialiasing]; samples >= 0; samples--, MSAAMask <<= 1)
                    {
                        _device.MultiSampleMask = MSAAMask;
                        effect.SetScreenOffset(ref Surface.MSAAPattern[samples]);
                        effect.Apply();
                        path.RenderFill();
                    }
            }
        }
예제 #2
0
파일: Pipeline.cs 프로젝트: liwq-net/XnaVG
        internal void StencilFill(IRenderable path)
        {
            var effect = Device.EffectManager.StencilFill;

            // Setup stenciling
            _device.BlendState = Device.BlendStates.NoColor;
            _device.DepthStencilState = State.FillRuleState;

            effect.SetParameters(State.Projection.Matrix, State.PathToSurface.Matrix);

            // Render mesh
            if (path.HasFill)
            {
                path.BeforeRenderFill();
                if (State.Antialiasing == VGAntialiasing.None)
                {
                    effect.Apply();
                    path.RenderFill();
                }
                else
                    for (int samples = (int)State.Antialiasing - 1, MSAAMask = _msaaMasks[State.Antialiasing]; samples >= 0; samples--, MSAAMask <<= 1)
                    {
                        _device.MultiSampleMask = MSAAMask;
                        effect.SetScreenOffset(ref Surface.MSAAPattern[samples]);
                        effect.Apply();
                        path.RenderFill();
                    }
            }
        }