Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/trunk/programs/TilingFP.cg @ 11335

Last change on this file since 11335 was 7708, checked in by dafrick, 14 years ago

Merging cleanup branch. You will need to update your data repository as well as your local copy of the code.

  • Property svn:eol-style set to native
File size: 945 bytes
Line 
1sampler RT : register(s0);
2
3float4 Tiling_ps(float4 inPos : POSITION,
4                                float2 iTexCoord : TEXCOORD0,
5                                uniform half NumTiles,
6                                uniform half Threshhold) : 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 - Threshhold;
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 < Threshhold) { c2 = c1; }
28    if (st.y < Threshhold) { 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.