0001:
0002:
0003:
0004:
0005:
0006:
0007:
0008:
0009:
0010:
0011: float MAP_WIDTH;
0012: float MAP_HEIGHT;
0013:
0014:
0015:
0016:
0017: texture SrcMap;
0018: sampler SrcSamp = sampler_state
0019: {
0020: Texture = <SrcMap>;
0021: MinFilter = POINT;
0022: MagFilter = POINT;
0023: MipFilter = NONE;
0024:
0025: AddressU = Clamp;
0026: AddressV = Clamp;
0027: };
0028:
0029:
0030:
0031: struct VS_OUTPUT
0032: {
0033: float4 Pos : POSITION;
0034: float2 ofset : COLOR0;
0035: float2 Tex0 : TEXCOORD0;
0036: float2 Tex1 : TEXCOORD1;
0037: float2 Tex2 : TEXCOORD2;
0038: float2 Tex3 : TEXCOORD3;
0039: };
0040:
0041:
0042:
0043:
0044:
0045:
0046:
0047:
0048:
0049:
0050: VS_OUTPUT VS_sat_x (
0051: float4 Pos : POSITION,
0052: float4 Tex : TEXCOORD0
0053: ){
0054: VS_OUTPUT Out = (VS_OUTPUT)0;
0055:
0056:
0057: Out.Pos = Pos;
0058:
0059: Out.Tex0 = Tex + float2( 0.5f/MAP_WIDTH, 0.5f/MAP_HEIGHT );
0060: Out.Tex1 = Tex + float2(-0.5f/MAP_WIDTH, 0.5f/MAP_HEIGHT );
0061:
0062: return Out;
0063: }
0064:
0065:
0066:
0067:
0068: VS_OUTPUT VS_sat_y (
0069: float4 Pos : POSITION,
0070: float4 Tex : TEXCOORD0
0071: ){
0072: VS_OUTPUT Out = (VS_OUTPUT)0;
0073:
0074:
0075: Out.Pos = Pos;
0076:
0077: Out.Tex0 = Tex + float2( 0.5f/MAP_WIDTH, 0.5f/MAP_HEIGHT );
0078: Out.Tex1 = Tex + float2( 0.5f/MAP_WIDTH,-0.5f/MAP_HEIGHT );
0079:
0080: return Out;
0081: }
0082:
0083:
0084:
0085:
0086: float4 PS_sat(VS_OUTPUT In) : COLOR
0087: {
0088: float4 Color;
0089:
0090: Color = tex2D( SrcSamp, In.Tex0 ) + tex2D( SrcSamp, In.Tex1 );
0091:
0092: return Color-0.5f;
0093: }
0094:
0095:
0096:
0097:
0098:
0099:
0100:
0101:
0102:
0103:
0104: VS_OUTPUT VS_out (
0105: float4 Pos : POSITION,
0106: float4 Tex : TEXCOORD0
0107: ){
0108: VS_OUTPUT Out = (VS_OUTPUT)0;
0109:
0110:
0111: Out.Pos = Pos;
0112:
0113: Out.Tex0 = Tex + float2( - 19.5f/MAP_WIDTH, -19.5f/MAP_HEIGHT );
0114: Out.Tex1 = Tex + float2( - 19.5f/MAP_WIDTH, +20.5f/MAP_HEIGHT );
0115: Out.Tex2 = Tex + float2( + 20.5f/MAP_WIDTH, -19.5f/MAP_HEIGHT );
0116: Out.Tex3 = Tex + float2( + 20.5f/MAP_WIDTH, +20.5f/MAP_HEIGHT );
0117:
0118: return Out;
0119: }
0120:
0121:
0122:
0123:
0124: float4 PS_out(VS_OUTPUT In) : COLOR
0125: {
0126: float4 Color;
0127:
0128: Color =( tex2D( SrcSamp, In.Tex0 )
0129: - tex2D( SrcSamp, In.Tex1 )
0130: - tex2D( SrcSamp, In.Tex2 )
0131: + tex2D( SrcSamp, In.Tex3 ))/(40.0f*40.0f);
0132:
0133: return Color+0.5f;
0134: }
0135:
0136:
0137:
0138:
0139: technique TShader
0140: {
0141: pass P0
0142: {
0143:
0144:
0145:
0146: VertexShader = compile vs_1_1 VS_sat_x();
0147: PixelShader = compile ps_1_1 PS_sat();
0148: }
0149: pass P1
0150: {
0151:
0152:
0153:
0154: VertexShader = compile vs_1_1 VS_sat_y();
0155: PixelShader = compile ps_1_1 PS_sat();
0156: }
0157: pass P2
0158: {
0159:
0160:
0161:
0162: VertexShader = compile vs_1_1 VS_out();
0163: PixelShader = compile ps_1_1 PS_out();
0164: }
0165: }
0166: