rayfract
diff src/rayfract.cc @ 4:e4349f5804b9
switched to imtk
author | John Tsiombikas <nuclear@siggraph.org> |
---|---|
date | Fri, 29 Apr 2011 07:30:31 +0300 |
parents | bf1d56975cc9 |
children | 48e0e7d33d9e |
line diff
1.1 --- a/src/rayfract.cc Tue Oct 26 09:52:57 2010 +0300 1.2 +++ b/src/rayfract.cc Fri Apr 29 07:30:31 2011 +0300 1.3 @@ -105,6 +105,11 @@ 1.4 glLightfv(GL_LIGHT0, GL_POSITION, lpos); 1.5 1.6 1.7 + set_uniform_float4(sdr, "seed", seed.x, seed.y, seed.z, seed.w); 1.8 + set_uniform_float(sdr, "reflectivity", reflectivity); 1.9 + set_uniform_int(sdr, "iter", iter); 1.10 + set_uniform_float(sdr, "err_thres", err_thres); 1.11 + 1.12 glMatrixMode(GL_TEXTURE); 1.13 glPushMatrix(); 1.14 glScalef(tex_scale.x, tex_scale.y, 1.0); 1.15 @@ -204,17 +209,13 @@ 1.16 break; 1.17 } 1.18 1.19 - utk::KeyboardEvent ev(key); 1.20 - ev.pressed = true; 1.21 - utk::event(&ev); 1.22 + imtk_inp_key(key, 1); 1.23 glutPostRedisplay(); 1.24 } 1.25 1.26 void keyb_up(unsigned char key, int x, int y) 1.27 { 1.28 - utk::KeyboardEvent ev(key); 1.29 - ev.pressed = false; 1.30 - utk::event(&ev); 1.31 + imtk_inp_key(key, 0); 1.32 glutPostRedisplay(); 1.33 } 1.34 1.35 @@ -223,9 +224,11 @@ 1.36 int prev_x = -1, prev_y; 1.37 void mouse(int bn, int state, int x, int y) 1.38 { 1.39 - utk::Container *utkroot = utk::get_root_widget(); 1.40 + int mod; 1.41 1.42 - if(utkroot->get_child_at(x, y) == utkroot) { 1.43 + mod = glutGetModifiers(); 1.44 + 1.45 + if(mod) { 1.46 bnstate[bn] = state == GLUT_DOWN ? 1 : 0; 1.47 if(state == GLUT_DOWN) { 1.48 if(bn == 3) { 1.49 @@ -242,11 +245,9 @@ 1.50 } else { 1.51 prev_x = -1; 1.52 } 1.53 + } else { 1.54 + imtk_inp_mouse(bn, state == GLUT_DOWN ? 1 : 0); 1.55 } 1.56 - 1.57 - utk::MButtonEvent ev(bn, x, y); 1.58 - ev.pressed = state == GLUT_DOWN; 1.59 - utk::event(&ev); 1.60 glutPostRedisplay(); 1.61 } 1.62 1.63 @@ -275,16 +276,14 @@ 1.64 prev_x = x; 1.65 prev_y = y; 1.66 1.67 - utk::MMotionEvent ev(x, y); 1.68 - utk::event(&ev); 1.69 + imtk_inp_motion(x, y); 1.70 glutPostRedisplay(); 1.71 } 1.72 1.73 void passive_motion(int x, int y) 1.74 { 1.75 - utk::MMotionEvent ev(x, y); 1.76 - utk::event(&ev); 1.77 - //glutPostRedisplay(); 1.78 + imtk_inp_motion(x, y); 1.79 + glutPostRedisplay(); 1.80 } 1.81 1.82 unsigned int create_ray_texture(int xsz, int ysz, float vfov, Vector2 *tex_scale)