Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/GLSL150/TilingFP.glsl

Last change on this file was 12115, checked in by wiesep, 5 years ago

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

File size: 911 bytes
Line 
1#version 150
2
3uniform sampler2D RT;
4uniform float NumTiles;
5uniform float Threshold;
6in vec2 oUv0;
7out vec4 fragColour;
8
9void main()
10{
11        vec3 EdgeColor = vec3(0.7, 0.7, 0.7);
12
13    float size = 1.0/NumTiles;
14    vec2 Pbase = oUv0 - mod(oUv0, vec2(size));
15    vec2 PCenter = vec2(Pbase + (size/2.0));
16    vec2 st = (oUv0 - Pbase)/size;
17    vec4 c1 = vec4(0.0);
18    vec4 c2 = vec4(0.0);
19    vec4 invOff = vec4((1.0-EdgeColor),1.0);
20    if (st.x > st.y) { c1 = invOff; }
21    float threshholdB =  1.0 - Threshold;
22    if (st.x > threshholdB) { c2 = c1; }
23    if (st.y > threshholdB) { c2 = c1; }
24    vec4 cBottom = c2;
25    c1 = vec4(0.0);
26    c2 = vec4(0.0);
27    if (st.x > st.y) { c1 = invOff; }
28    if (st.x < Threshold) { c2 = c1; }
29    if (st.y < Threshold) { c2 = c1; }
30    vec4 cTop = c2;
31    vec4 tileColor = vec4(texture(RT, PCenter));
32    vec4 result = tileColor + cTop - cBottom;
33    fragColour = result;
34}
Note: See TracBrowser for help on using the repository browser.