Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/Cg/TilingFP.cg @ 12373

Last change on this file since 12373 was 12115, checked in by wiesep, 6 years ago

Changed folder structure, deletet some unused files and cleaned up code

File size: 943 bytes
Line 
1sampler2D RT : register(s0);
2
3float4 Tiling_ps(float4 inPos : POSITION,
4                                float2 iTexCoord : TEXCOORD0,
5                                uniform half NumTiles,
6                                uniform half Threshold) : COLOR
7{
8
9
10        half3 EdgeColor = {0.7, 0.7, 0.7};
11
12    half size = 1.0/NumTiles;
13    half2 Pbase = iTexCoord - fmod(iTexCoord, size.xx);
14    half2 PCenter = Pbase + (size/2.0).xx;
15    half2 st = (iTexCoord - Pbase)/size;
16    half4 c1 = (half4)0;
17    half4 c2 = (half4)0;
18    half4 invOff = half4((1-EdgeColor),1);
19    if (st.x > st.y) { c1 = invOff; }
20    half threshholdB =  1.0 - Threshold;
21    if (st.x > threshholdB) { c2 = c1; }
22    if (st.y > threshholdB) { c2 = c1; }
23    half4 cBottom = c2;
24    c1 = (half4)0;
25    c2 = (half4)0;
26    if (st.x > st.y) { c1 = invOff; }
27    if (st.x < Threshold) { c2 = c1; }
28    if (st.y < Threshold) { c2 = c1; }
29    half4 cTop = c2;
30    half4 tileColor = tex2D(RT, PCenter);
31    half4 result = tileColor + cTop - cBottom;
32    return result;
33}
Note: See TracBrowser for help on using the repository browser.