istereo

changeset 22:889dade25667

added fog
author John Tsiombikas <nuclear@mutantstargoat.com>
date Wed, 07 Sep 2011 10:56:18 +0300
parents 75a63f9ab7cc
children e3742aafc85b
files sdr/test.p.glsl sdr/test.v.glsl src/istereo.c
diffstat 3 files changed, 11 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/sdr/test.p.glsl	Wed Sep 07 10:49:11 2011 +0300
     1.2 +++ b/sdr/test.p.glsl	Wed Sep 07 10:56:18 2011 +0300
     1.3 @@ -4,13 +4,19 @@
     1.4  
     1.5  uniform sampler2D tex;
     1.6  
     1.7 +varying vec3 vpos;
     1.8  varying vec4 var_color;
     1.9  varying vec2 var_texcoord;
    1.10  
    1.11  void main()
    1.12  {
    1.13 +	vec4 fog_color = vec4(0.6, 0.6, 0.6, 1.0);
    1.14 +
    1.15 +	float fog = exp(-(0.2 * -vpos.z));
    1.16 +
    1.17  	vec4 texel = texture2D(tex, var_texcoord);
    1.18  	texel.w = 1.0;
    1.19  
    1.20 -	gl_FragColor = var_color * texel;
    1.21 +	vec4 col = var_color * texel;
    1.22 +	gl_FragColor = mix(fog_color, col, fog);
    1.23  }
     2.1 --- a/sdr/test.v.glsl	Wed Sep 07 10:49:11 2011 +0300
     2.2 +++ b/sdr/test.v.glsl	Wed Sep 07 10:56:18 2011 +0300
     2.3 @@ -3,6 +3,7 @@
     2.4  attribute vec4 attr_vertex, attr_color;
     2.5  attribute vec2 attr_texcoord;
     2.6  
     2.7 +varying vec3 vpos;
     2.8  varying vec4 var_color;
     2.9  varying vec2 var_texcoord;
    2.10  
    2.11 @@ -10,6 +11,7 @@
    2.12  {
    2.13  	mat4 mvp = matrix_projection * matrix_modelview;
    2.14  	gl_Position = mvp * attr_vertex;
    2.15 +	vpos = (matrix_modelview * attr_vertex).xyz;
    2.16  	var_color = attr_color;
    2.17  	var_texcoord = attr_texcoord;
    2.18  }
     3.1 --- a/src/istereo.c	Wed Sep 07 10:49:11 2011 +0300
     3.2 +++ b/src/istereo.c	Wed Sep 07 10:56:18 2011 +0300
     3.3 @@ -47,7 +47,7 @@
     3.4  		return -1;
     3.5  	}
     3.6  
     3.7 -	cam_fov(30.0);
     3.8 +	cam_fov(43.0);
     3.9  
    3.10  	return 0;
    3.11  }
    3.12 @@ -65,6 +65,7 @@
    3.13  	z = ring_height * segm;
    3.14  	worm(tsec, z, &pan_x, &pan_y);
    3.15  
    3.16 +	glClearColor(0.6, 0.6, 0.6, 1.0);
    3.17  	glClear(GL_COLOR_BUFFER_BIT);
    3.18  
    3.19  	if(stereo) {