vrshoot
diff sdr/default.p.glsl @ 0:b2f14e535253
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 01 Feb 2014 19:58:19 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/sdr/default.p.glsl Sat Feb 01 19:58:19 2014 +0200 1.3 @@ -0,0 +1,28 @@ 1.4 +varying vec3 vpos, norm; 1.5 +varying vec2 texcoord; 1.6 + 1.7 +void main() 1.8 +{ 1.9 + vec3 n = normalize(norm); 1.10 + vec3 ldir = normalize(vec3(-0.5, 0.5, 2)); 1.11 + 1.12 + float ndotl = max(dot(n, ldir), 0.0); 1.13 + 1.14 + vec3 color = vec3(0.8, 0.8, 0.8) * ndotl; 1.15 + 1.16 + float hpat = smoothstep(0.49, 0.5, mod(texcoord.x * 8.0, 1.0)); 1.17 + float vpat = smoothstep(0.49, 0.5, mod(texcoord.y * 8.0, 1.0)); 1.18 + 1.19 + float pattern = 0.0; 1.20 + if((hpat > 0.5 && vpat > 0.5) || (hpat < 0.5 && vpat < 0.5)) { 1.21 + pattern = 1.0; 1.22 + } else { 1.23 + pattern = 0.0; 1.24 + } 1.25 + 1.26 + vec3 tex = vec3(pattern * 0.5 + 0.5); 1.27 + 1.28 + 1.29 + gl_FragColor.rgb = color * tex; 1.30 + gl_FragColor.a = 1.0; 1.31 +}