|
Last change
on this file since 12091 was
12091,
checked in by wiesep, 7 years ago
|
|
Updated programs and adjusted Material to work with GLSL>150
|
|
File size:
944 bytes
|
| Line | |
|---|
| 1 | #version 100 |
|---|
| 2 | |
|---|
| 3 | precision mediump int; |
|---|
| 4 | precision mediump float; |
|---|
| 5 | |
|---|
| 6 | uniform sampler2D RT; |
|---|
| 7 | uniform float NumTiles; |
|---|
| 8 | uniform float Threshold; |
|---|
| 9 | varying vec2 uv0; |
|---|
| 10 | |
|---|
| 11 | void main() |
|---|
| 12 | { |
|---|
| 13 | vec3 EdgeColor = vec3(0.7, 0.7, 0.7); |
|---|
| 14 | |
|---|
| 15 | float size = 1.0/NumTiles; |
|---|
| 16 | vec2 Pbase = uv0 - mod(uv0, vec2(size)); |
|---|
| 17 | vec2 PCenter = vec2(Pbase + (size/2.0)); |
|---|
| 18 | vec2 st = (uv0 - Pbase)/size; |
|---|
| 19 | vec4 c1 = vec4(0.0); |
|---|
| 20 | vec4 c2 = vec4(0.0); |
|---|
| 21 | vec4 invOff = vec4((1.0-EdgeColor),1.0); |
|---|
| 22 | if (st.x > st.y) { c1 = invOff; } |
|---|
| 23 | float threshholdB = 1.0 - Threshold; |
|---|
| 24 | if (st.x > threshholdB) { c2 = c1; } |
|---|
| 25 | if (st.y > threshholdB) { c2 = c1; } |
|---|
| 26 | vec4 cBottom = c2; |
|---|
| 27 | c1 = vec4(0.0); |
|---|
| 28 | c2 = vec4(0.0); |
|---|
| 29 | if (st.x > st.y) { c1 = invOff; } |
|---|
| 30 | if (st.x < Threshold) { c2 = c1; } |
|---|
| 31 | if (st.y < Threshold) { c2 = c1; } |
|---|
| 32 | vec4 cTop = c2; |
|---|
| 33 | vec4 tileColor = vec4(texture2D(RT, PCenter)); |
|---|
| 34 | vec4 result = tileColor + cTop - cBottom; |
|---|
| 35 | gl_FragColor = result; |
|---|
| 36 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.