invisible

changeset 24:8b81571dd4dd

fooo
author Eleni Maria Stea <eleni@mutantstargoat.com>
date Sun, 17 Nov 2013 00:15:04 +0200
parents b50ad2711f5f
children 96b022f1210e
files data/shaders/invisible.f.glsl data/shaders/invisible.v.glsl src/frame.cc
diffstat 3 files changed, 9 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/data/shaders/invisible.f.glsl	Sat Nov 16 23:29:15 2013 +0200
     1.2 +++ b/data/shaders/invisible.f.glsl	Sun Nov 17 00:15:04 2013 +0200
     1.3 @@ -1,4 +1,5 @@
     1.4  uniform sampler2D tex;
     1.5 +varying float mask;
     1.6  
     1.7  void main()
     1.8  {
     2.1 --- a/data/shaders/invisible.v.glsl	Sat Nov 16 23:29:15 2013 +0200
     2.2 +++ b/data/shaders/invisible.v.glsl	Sun Nov 17 00:15:04 2013 +0200
     2.3 @@ -1,10 +1,15 @@
     2.4  uniform sampler2D depth_tex;
     2.5 +varying float mask;
     2.6  
     2.7  void main()
     2.8  {
     2.9 -	float depth = texture2D(depth_tex, gl_MultiTexCoord0.xy).r;
    2.10 +	const float threshold = 0.8;
    2.11 +	const float scale = 4.0;
    2.12 +
    2.13 +	float texel = texture2D(depth_tex, gl_MultiTexCoord0.xy).r;
    2.14  	vec4 vpos = gl_Vertex;
    2.15 -	vpos.z = depth;
    2.16 +	mask = 1.0 - step(threshold, texel);
    2.17 +	vpos.z = texel * mask * scale;
    2.18  
    2.19  	gl_Position = gl_ModelViewProjectionMatrix * vpos;
    2.20  	gl_TexCoord[0] = gl_MultiTexCoord0;
     3.1 --- a/src/frame.cc	Sat Nov 16 23:29:15 2013 +0200
     3.2 +++ b/src/frame.cc	Sun Nov 17 00:15:04 2013 +0200
     3.3 @@ -100,7 +100,7 @@
     3.4  		if(val >= 2047) {
     3.5  			val = 2047;
     3.6  		}
     3.7 -		*dest = val >> 3;
     3.8 +		*dest = val >> 2; //should be >> 3
     3.9  		src++;
    3.10  		dest++;
    3.11  	}