コード例 #1
0
        public void Render(CommandList cl, IStyleEffectsStageModel stage, GpuSurface source, GpuSurface target)
        {
            if (cl == null || stage == null || source == null || target == null)
            {
                _frameworkMessenger.Report("Warning: you are feeding the Style Effect Stage Renderer null inputs, aborting");
                return;
            }

            //Updated every time as holds the shared TexelSize
            var factors = new PixellateFactors
            {
                PixAmount     = stage.PixellateCurrent.Intensity,
                NumXDivisions = stage.PixellateCurrent.NumXDivisions,
                NumYDivisions = stage.PixellateCurrent.NumYDivisions,
                Pad0          = 0,
                TexelSize     = new Vector2(1.0f / (1.0f * target.Framebuffer.Width), 1.0f / (1.0f * target.Framebuffer.Height)),
                Pad1          = Vector2.Zero
            };

            _systemComponents.Device.UpdateBuffer(stage.PixellateBuffer, 0, ref factors);

            cl.SetFramebuffer(target.Framebuffer);
            _viewportManager.ConfigureViewportForActiveFramebuffer(cl);
            cl.SetVertexBuffer(0, _ndcQuadVertexBuffer.Buffer);
            cl.SetPipeline(_pipeline);
            cl.SetGraphicsResourceSet(0, source.ResourceSet_TexMirror);
            cl.SetGraphicsResourceSet(1, _gpuSurfaceManager.Noise.ResourceSet_TexWrap);
            cl.SetGraphicsResourceSet(2, _gpuSurfaceManager.CrtShadowMask.ResourceSet_TexWrap);
            cl.SetGraphicsResourceSet(3, stage.PixellateResourceSet);
            cl.SetGraphicsResourceSet(4, stage.EdgeDetectionResourceSet);
            cl.SetGraphicsResourceSet(5, stage.StaticResourceSet);
            cl.SetGraphicsResourceSet(6, stage.OldMovieResourceSet);
            cl.SetGraphicsResourceSet(7, stage.CrtEffectResourceSet);
            cl.Draw(6);
        }
コード例 #2
0
        private void UpdatePixellateBuffer()
        {
            var factors = new PixellateFactors
            {
                PixAmount     = PixellateCurrent.Intensity,
                NumXDivisions = PixellateCurrent.NumXDivisions,
                NumYDivisions = PixellateCurrent.NumYDivisions,
                Pad0          = 0,
                TexelSize     = Vector2.Zero,
                Pad1          = Vector2.Zero
            };

            _systemComponents.Device.UpdateBuffer(PixellateBuffer, 0, ref factors);
        }