invisible
annotate data/shaders/invisible.v.glsl @ 25:96b022f1210e
'w' to switch to wireframe
author | Eleni Maria Stea <eleni@mutantstargoat.com> |
---|---|
date | Sun, 17 Nov 2013 12:46:45 +0200 |
parents | b50ad2711f5f |
children | 61d593076c56 |
rev | line source |
---|---|
eleni@23 | 1 uniform sampler2D depth_tex; |
eleni@24 | 2 varying float mask; |
eleni@23 | 3 |
eleni@23 | 4 void main() |
eleni@23 | 5 { |
eleni@24 | 6 const float threshold = 0.8; |
eleni@24 | 7 const float scale = 4.0; |
eleni@24 | 8 |
eleni@24 | 9 float texel = texture2D(depth_tex, gl_MultiTexCoord0.xy).r; |
eleni@23 | 10 vec4 vpos = gl_Vertex; |
eleni@24 | 11 mask = 1.0 - step(threshold, texel); |
eleni@24 | 12 vpos.z = texel * mask * scale; |
eleni@23 | 13 |
eleni@23 | 14 gl_Position = gl_ModelViewProjectionMatrix * vpos; |
eleni@23 | 15 gl_TexCoord[0] = gl_MultiTexCoord0; |
eleni@23 | 16 } |