Last change
on this file since 12202 was
12115,
checked in by wiesep, 6 years ago
|
Changed folder structure, deletet some unused files and cleaned up code
|
File size:
911 bytes
|
Rev | Line | |
---|
[12115] | 1 | #version 150 |
---|
| 2 | |
---|
| 3 | uniform sampler2D RT; |
---|
| 4 | uniform float NumTiles; |
---|
| 5 | uniform float Threshold; |
---|
| 6 | in vec2 oUv0; |
---|
| 7 | out vec4 fragColour; |
---|
| 8 | |
---|
| 9 | void 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.