vrshoot
annotate sdr/default.p.glsl @ 3:c179c72369be
rename candy->vr
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 03 Feb 2014 08:52:13 +0200 |
parents | |
children |
rev | line source |
---|---|
nuclear@0 | 1 varying vec3 vpos, norm; |
nuclear@0 | 2 varying vec2 texcoord; |
nuclear@0 | 3 |
nuclear@0 | 4 void main() |
nuclear@0 | 5 { |
nuclear@0 | 6 vec3 n = normalize(norm); |
nuclear@0 | 7 vec3 ldir = normalize(vec3(-0.5, 0.5, 2)); |
nuclear@0 | 8 |
nuclear@0 | 9 float ndotl = max(dot(n, ldir), 0.0); |
nuclear@0 | 10 |
nuclear@0 | 11 vec3 color = vec3(0.8, 0.8, 0.8) * ndotl; |
nuclear@0 | 12 |
nuclear@0 | 13 float hpat = smoothstep(0.49, 0.5, mod(texcoord.x * 8.0, 1.0)); |
nuclear@0 | 14 float vpat = smoothstep(0.49, 0.5, mod(texcoord.y * 8.0, 1.0)); |
nuclear@0 | 15 |
nuclear@0 | 16 float pattern = 0.0; |
nuclear@0 | 17 if((hpat > 0.5 && vpat > 0.5) || (hpat < 0.5 && vpat < 0.5)) { |
nuclear@0 | 18 pattern = 1.0; |
nuclear@0 | 19 } else { |
nuclear@0 | 20 pattern = 0.0; |
nuclear@0 | 21 } |
nuclear@0 | 22 |
nuclear@0 | 23 vec3 tex = vec3(pattern * 0.5 + 0.5); |
nuclear@0 | 24 |
nuclear@0 | 25 |
nuclear@0 | 26 gl_FragColor.rgb = color * tex; |
nuclear@0 | 27 gl_FragColor.a = 1.0; |
nuclear@0 | 28 } |