istereo
diff src/istereo.c @ 30:8dd271942543
fixed everything
author | John Tsiombikas <nuclear@mutantstargoat.com> |
---|---|
date | Thu, 08 Sep 2011 14:52:13 +0300 |
parents | fd39c0198935 |
children | bc6db80aaa58 |
line diff
1.1 --- a/src/istereo.c Thu Sep 08 08:31:15 2011 +0300 1.2 +++ b/src/istereo.c Thu Sep 08 14:52:13 2011 +0300 1.3 @@ -31,7 +31,7 @@ 1.4 #else 1.5 int stereo = 0; 1.6 #endif 1.7 -int use_bump = 1; 1.8 +int use_bump = 0; 1.9 1.10 /* construction parameters */ 1.11 int sides = 24; 1.12 @@ -41,7 +41,7 @@ 1.13 float text_period = 13.0; 1.14 float text_speed = 2.2; 1.15 1.16 -float split = 0.53; 1.17 +float split = 0.5275; 1.18 1.19 int init(void) 1.20 { 1.21 @@ -74,7 +74,8 @@ 1.22 glEnable(GL_DEPTH_TEST); 1.23 glEnable(GL_CULL_FACE); 1.24 1.25 - cam_fov(45.0); 1.26 + cam_fov(42.5); 1.27 + cam_clip(0.5, 250.0); 1.28 1.29 return 0; 1.30 } 1.31 @@ -99,6 +100,7 @@ 1.32 glClearColor(0.6, 0.6, 0.6, 1.0); 1.33 tunnel_speed = 0.75; 1.34 } 1.35 + glClearDepthf(1.0); 1.36 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 1.37 1.38 if(stereo) { 1.39 @@ -156,13 +158,15 @@ 1.40 1.41 draw_tunnel(t); 1.42 1.43 - glDepthMask(0); 1.44 - text_line = floor((text_speed * t) / text_period); 1.45 - for(i=0; i<15; i++) { 1.46 - vec3_t tpos = calc_text_pos(t - (float)i * 0.01); 1.47 - draw_text(text_line, tpos, 1.5 / (float)i); 1.48 + if(use_bump) { 1.49 + glDepthMask(0); 1.50 + text_line = floor((text_speed * t) / text_period); 1.51 + for(i=0; i<8; i++) { 1.52 + vec3_t tpos = calc_text_pos(t - (float)i * 0.015); 1.53 + draw_text(text_line, tpos, 1.5 / (float)i); 1.54 + } 1.55 + glDepthMask(1); 1.56 } 1.57 - glDepthMask(1); 1.58 } 1.59 1.60 static void draw_tunnel(float t) 1.61 @@ -176,19 +180,22 @@ 1.62 1.63 bind_program(prog); 1.64 set_uniform_float(prog, "t", t); 1.65 - set_uniform_int(prog, "tex", 0); 1.66 1.67 if(use_bump) { 1.68 vec3_t ltpos = calc_text_pos(t); 1.69 1.70 + bind_texture(tex_normal, 1); 1.71 set_uniform_int(prog, "tex_norm", 1); 1.72 + bind_texture(tex_stones, 0); 1.73 + set_uniform_int(prog, "tex", 0); 1.74 + 1.75 set_uniform_float4(prog, "light_pos", ltpos.x, ltpos.y, ltpos.z, 1.0); 1.76 tang_loc = get_attrib_loc(prog, "attr_tangent"); 1.77 - bind_texture(tex_normal, 1); 1.78 + } else { 1.79 + bind_texture(tex, 0); 1.80 + set_uniform_int(prog, "tex", 0); 1.81 } 1.82 1.83 - bind_texture(tex, 0); 1.84 - 1.85 gl_matrix_mode(GL_TEXTURE); 1.86 gl_load_identity(); 1.87 gl_translatef(0, -t * tunnel_speed, 0); 1.88 @@ -206,9 +213,6 @@ 1.89 float z0 = ring_height * i; 1.90 float z1 = ring_height * (i + 1); 1.91 1.92 - float v0 = (float)i / (float)segm; 1.93 - float v1 = (float)(i + 1) / (float)segm; 1.94 - 1.95 worm(t, zp, trans_zp, trans_zp + 1); 1.96 worm(t, z0, trans_z0, trans_z0 + 1); 1.97 worm(t, z1, trans_z1, trans_z1 + 1);