oculus2_psprite
diff sdr/psprite.p.glsl @ 21:dc7af0f549b2
VR point sprite shooting test
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Thu, 22 Jan 2015 06:19:52 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/sdr/psprite.p.glsl Thu Jan 22 06:19:52 2015 +0200 1.3 @@ -0,0 +1,12 @@ 1.4 +#version 120 1.5 + 1.6 +void main() 1.7 +{ 1.8 + vec2 pt = gl_PointCoord.xy * 2.0 - 1.0; 1.9 + float len = length(pt); 1.10 + vec2 dir = pt / len; 1.11 + float angle = atan(dir.y, dir.x); 1.12 + 1.13 + float alpha = 1.0 - smoothstep(0.8, 0.9, len + abs(sin(angle * 8.0)) * 0.1); 1.14 + gl_FragColor = vec4(1.0, 1.0, 1.0, alpha); 1.15 +}