//Pixel Shader for TEV stages //7 TEV stages, 7 texgens, 0 IND stages uniform sampler2D samp0 : register(s0); uniform sampler2D samp1 : register(s1); uniform sampler2D samp2 : register(s2); uniform sampler2D samp3 : register(s3); uniform sampler2D samp4 : register(s4); uniform sampler2D samp5 : register(s5); uniform sampler2D samp6 : register(s6); uniform sampler2D samp7 : register(s7); uniform float4 color[4] : register(c0); uniform float4 k[4] : register(c4); uniform float4 alphaRef[1] : register(c8); uniform float4 texdim[8] : register(c9); uniform float4 czbias[2] : register(c17); uniform float4 cindscale[2] : register(c19); uniform float4 cindmtx[6] : register(c21); uniform float4 cfog[3] : register(c27); uniform float4 cPLights[40] : register(c30); uniform float4 cPmtrl[4] : register(c70); void main( out float4 ocol0 : COLOR0, in float4 rawpos : VPOS, in float4 colors_0 : COLOR0, in float4 colors_1 : COLOR1, in float4 uv0 : TEXCOORD0, in float4 uv1 : TEXCOORD1, in float4 uv2 : TEXCOORD2, in float4 uv3 : TEXCOORD3, in float3 uv4 : TEXCOORD4, in float3 uv5 : TEXCOORD5, in float3 uv6 : TEXCOORD6 ) { float4 clipPos = float4(0.0f, 0.0f, 0.0f, 0.0f); float4 c0 = color[1], c1 = color[2], c2 = color[3], prev = float4(0.0f, 0.0f, 0.0f, 0.0f), textemp = float4(0.0f, 0.0f, 0.0f, 0.0f), rastemp = float4(0.0f, 0.0f, 0.0f, 0.0f), konsttemp = float4(0.0f, 0.0f, 0.0f, 0.0f); float3 comp16 = float3(1.0f, 255.0f, 0.0f), comp24 = float3(1.0f, 255.0f, 255.0f*255.0f); float alphabump=0.0f; float3 tevcoord=float3(0.0f, 0.0f, 0.0f); float2 wrappedcoord=float2(0.0f,0.0f), tempcoord=float2(0.0f,0.0f); float4 cc0=float4(0.0f,0.0f,0.0f,0.0f), cc1=float4(0.0f,0.0f,0.0f,0.0f); float4 cc2=float4(0.0f,0.0f,0.0f,0.0f), cprev=float4(0.0f,0.0f,0.0f,0.0f); float4 crastemp=float4(0.0f,0.0f,0.0f,0.0f),ckonsttemp=float4(0.0f,0.0f,0.0f,0.0f); float4 clipPos = float4(rawpos.x, rawpos.y, uv2.w, uv3.w); uv0.xy = uv0.xy * texdim[0].zw; uv1.xy = uv1.xy * texdim[1].zw; uv2.xy = uv2.xy * texdim[2].zw; uv3.xy = uv3.xy * texdim[3].zw; uv4.xy = uv4.xy * texdim[4].zw; uv5.xy = uv5.xy * texdim[5].zw; uv6.xy = uv6.xy * texdim[6].zw; // TEV stage 0 tevcoord.xy = uv0.xy; textemp=tex2D(samp7,tevcoord.xy * texdim[7].xy).rgba; konsttemp = float4(k[0].rgb, k[0].a); ckonsttemp = frac(konsttemp * (255.0f/256.0f)) * (256.0f/255.0f); // color combine prev.rgb = clamp((textemp.rgb)*(ckonsttemp.rgb), 0.0, 1.0); // alpha combine prev.a = clamp(konsttemp.a+float4(0.0f, 0.0f, 0.0f, 0.0f).a, 0.0, 1.0); // TEV done // TEV stage 1 tevcoord.xy = uv1.xy; textemp=tex2D(samp7,tevcoord.xy * texdim[7].xy).rgba; konsttemp = float4(k[0].rgb, 1.0f); ckonsttemp = frac(konsttemp * (255.0f/256.0f)) * (256.0f/255.0f); // color combine prev.rgb = clamp((prev.rgb)+(textemp.rgb)*(ckonsttemp.rgb), 0.0, 1.0); // alpha combine prev.a = clamp(prev.a+float4(0.0f, 0.0f, 0.0f, 0.0f).a, 0.0, 1.0); // TEV done // TEV stage 2 tevcoord.xy = uv2.xy; textemp=tex2D(samp7,tevcoord.xy * texdim[7].xy).rgba; konsttemp = float4(k[0].rgb, 1.0f); ckonsttemp = frac(konsttemp * (255.0f/256.0f)) * (256.0f/255.0f); // color combine prev.rgb = clamp((prev.rgb)+(textemp.rgb)*(ckonsttemp.rgb), 0.0, 1.0); // alpha combine prev.a = clamp(prev.a+float4(0.0f, 0.0f, 0.0f, 0.0f).a, 0.0, 1.0); // TEV done // TEV stage 3 tevcoord.xy = uv3.xy; textemp=tex2D(samp7,tevcoord.xy * texdim[7].xy).rgba; konsttemp = float4(k[0].rgb, 1.0f); ckonsttemp = frac(konsttemp * (255.0f/256.0f)) * (256.0f/255.0f); // color combine prev.rgb = clamp((prev.rgb)+(textemp.rgb)*(ckonsttemp.rgb), 0.0, 1.0); // alpha combine prev.a = clamp(prev.a+float4(0.0f, 0.0f, 0.0f, 0.0f).a, 0.0, 1.0); // TEV done // TEV stage 4 tevcoord.xy = uv4.xy; textemp=tex2D(samp7,tevcoord.xy * texdim[7].xy).rgba; konsttemp = float4(k[0].rgb, 1.0f); ckonsttemp = frac(konsttemp * (255.0f/256.0f)) * (256.0f/255.0f); // color combine prev.rgb = clamp((prev.rgb)+(textemp.rgb)*(ckonsttemp.rgb), 0.0, 1.0); // alpha combine prev.a = clamp(prev.a+float4(0.0f, 0.0f, 0.0f, 0.0f).a, 0.0, 1.0); // TEV done // TEV stage 5 tevcoord.xy = uv5.xy; textemp=tex2D(samp7,tevcoord.xy * texdim[7].xy).rgba; konsttemp = float4(k[0].rgb, 1.0f); ckonsttemp = frac(konsttemp * (255.0f/256.0f)) * (256.0f/255.0f); // color combine prev.rgb = clamp((prev.rgb)+(textemp.rgb)*(ckonsttemp.rgb), 0.0, 1.0); // alpha combine prev.a = clamp(prev.a+float4(0.0f, 0.0f, 0.0f, 0.0f).a, 0.0, 1.0); // TEV done // TEV stage 6 tevcoord.xy = uv6.xy; textemp=tex2D(samp7,tevcoord.xy * texdim[7].xy).rgba; konsttemp = float4(k[0].rgb, 1.0f); ckonsttemp = frac(konsttemp * (255.0f/256.0f)) * (256.0f/255.0f); // color combine prev.rgb = clamp((prev.rgb)+(textemp.rgb)*(ckonsttemp.rgb), 0.0, 1.0); // alpha combine prev.a = clamp(prev.a+float4(0.0f, 0.0f, 0.0f, 0.0f).a, 0.0, 1.0); // TEV done float zCoord = czbias[1].x + (clipPos.z / clipPos.w) * czbias[1].y; ocol0 = prev; }