Beispiel #1
0
        public void StretchRect4x4( RenderTargetSurface dst, RenderTarget2D src, SamplerState filter = null )
        {
            SetDefaultRenderStates();

            using( new PixEvent() ) {

                rs.SetTargets( null, dst );
                SetViewport(dst);

                rs.PipelineState			=	factory[ (int)ShaderFlags.DOWNSAMPLE_2_4x4 ];
                rs.VertexShaderResources[0] =	src;
                rs.PixelShaderResources[0]	=	src;
                rs.PixelShaderSamplers[0]	=	filter ?? SamplerState.LinearPointClamp;

                rs.Draw( 3, 0 );
            }
            rs.ResetStates();
        }
Beispiel #2
0
 public void Restart( SpriteBlend spriteBlend = SpriteBlend.AlphaBlend, SamplerState ss = null, DepthStencilState dss = null, Matrix? transform = null, Rectangle? clip = null )
 {
     Restart( pipelineStates[ spriteBlend ], ss, dss, transform, clip );
 }
Beispiel #3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="bs"></param>
 /// <param name="ss"></param>
 /// <param name="rs"></param>
 /// <param name="dss"></param>
 /// <param name="transform"></param>
 /// <param name="clip"></param>
 public void Restart( PipelineState ps, SamplerState ss = null, DepthStencilState dss = null, Matrix? transform = null, Rectangle? clip = null )
 {
     End();
     Begin( ps, ss, dss, transform, clip );
 }
Beispiel #4
0
        /// <summary>
        /// 
        /// </summary>
        public void Begin( PipelineState ps, SamplerState ss = null, DepthStencilState dss = null, Matrix? transform = null, Rectangle? clip = null )
        {
            if (ps==null) {
                throw new ArgumentNullException("ps");
            }

            pipelineState		=	ps;
            samplerState		=	ss	?? SamplerState.LinearWrap;
            depthStencilState	=	dss	?? DepthStencilState.Readonly;

            int	w	=	device.DisplayBounds.Width;
            int h	=	device.DisplayBounds.Height;
            var ofs	=	0.0f;

            Matrix sbTransform;
            if (transform.HasValue) {
                sbTransform = transform.Value;
            } else {
                sbTransform = Matrix.OrthoOffCenterRH(ofs, w + ofs, h + ofs, ofs, -9999, 9999);
            }

            Vector4 clipRect  = new Vector4(0,0,w,h);

            if ( clip.HasValue ) {
                clipRect.X = clip.Value.X;
                clipRect.Y = clip.Value.Y;
                clipRect.Z = clip.Value.Width;
                clipRect.W = clip.Value.Height;
            }

            device.PipelineState			=	pipelineState;
            device.PixelShaderSamplers[0]	=	samplerState;

            constData.Transform		=	sbTransform;
            constData.ClipRectangle	=	clipRect;
            constBuffer.SetData( constData );
        }