rayfract
diff src/gui.cc @ 5:48e0e7d33d9e
foo
author | John Tsiombikas <nuclear@siggraph.org> |
---|---|
date | Sat, 28 May 2011 22:31:07 +0300 |
parents | e4349f5804b9 |
children | 8a9aa21b32cf |
line diff
1.1 --- a/src/gui.cc Fri Apr 29 07:30:31 2011 +0300 1.2 +++ b/src/gui.cc Sat May 28 22:31:07 2011 +0300 1.3 @@ -1,4 +1,5 @@ 1.4 #include <stdio.h> 1.5 +#include <math.h> 1.6 1.7 #ifndef __APPLE__ 1.8 #include <GL/glut.h> 1.9 @@ -11,55 +12,64 @@ 1.10 #include "sdr.h" 1.11 #include "vmath.h" 1.12 1.13 - 1.14 -int xsz, ysz; 1.15 static int show_gui = 1; 1.16 +static float fiter = 10; 1.17 1.18 extern unsigned int sdr; 1.19 extern Vector4 seed; 1.20 extern int iter; 1.21 extern float err_thres; 1.22 extern float reflectivity; 1.23 +extern Vector3 color; 1.24 1.25 int gui_init(int width, int height) 1.26 { 1.27 - xsz = width; 1.28 - ysz = height; 1.29 - 1.30 imtk_set_viewport(width, height); 1.31 - 1.32 - /*imtk_set_alpha(0.5);*/ 1.33 + imtk_set_alpha(0.5); 1.34 return 0; 1.35 } 1.36 1.37 void gui_draw() 1.38 { 1.39 + 1.40 if(!show_gui) { 1.41 return; 1.42 } 1.43 1.44 imtk_begin(); 1.45 + imtk_layout_start(10, 10, 10, IMTK_HORIZONTAL); 1.46 1.47 - imtk_label("seed x", 10, 20); 1.48 - seed.x = imtk_slider(IMUID, seed.x, -1.0, 1.0, 80, 20); 1.49 + imtk_label("seed x", IMTK_AUTO, IMTK_AUTO); 1.50 + seed.x = imtk_slider(IMUID, seed.x, -1.0, 1.0, IMTK_AUTO, IMTK_AUTO); 1.51 + imtk_layout_newline(); 1.52 1.53 - imtk_label("seed y", 10, 50); 1.54 - seed.y = imtk_slider(IMUID, seed.y, -1.0, 1.0, 80, 50); 1.55 + imtk_label("seed y", IMTK_AUTO, IMTK_AUTO); 1.56 + seed.y = imtk_slider(IMUID, seed.y, -1.0, 1.0, IMTK_AUTO, IMTK_AUTO); 1.57 + imtk_layout_newline(); 1.58 1.59 - imtk_label("seed z", 10, 80); 1.60 - seed.z = imtk_slider(IMUID, seed.z, -1.0, 1.0, 80, 80); 1.61 + imtk_label("seed z", IMTK_AUTO, IMTK_AUTO); 1.62 + seed.z = imtk_slider(IMUID, seed.z, -1.0, 1.0, IMTK_AUTO, IMTK_AUTO); 1.63 + imtk_layout_newline(); 1.64 1.65 - imtk_label("seed w", 10, 110); 1.66 - seed.w = imtk_slider(IMUID, seed.w, -1.0, 1.0, 80, 110); 1.67 + imtk_label("seed w", IMTK_AUTO, IMTK_AUTO); 1.68 + seed.w = imtk_slider(IMUID, seed.w, -2.0, 2.0, IMTK_AUTO, IMTK_AUTO); 1.69 + imtk_layout_newline(); 1.70 1.71 - imtk_label("iterations", 10, 140); 1.72 - iter = imtk_slider(IMUID, iter, 0, 32, 80, 140); 1.73 + imtk_label("iterations", IMTK_AUTO, IMTK_AUTO); 1.74 + fiter = imtk_slider(IMUID, fiter, 0, 32, IMTK_AUTO, IMTK_AUTO); 1.75 + iter = round(fiter); 1.76 + imtk_layout_newline(); 1.77 1.78 - imtk_label("max error", 10, 170); 1.79 - err_thres = imtk_slider(IMUID, err_thres, 0, 0.075, 80, 170); 1.80 + imtk_label("max error", IMTK_AUTO, IMTK_AUTO); 1.81 + err_thres = imtk_slider(IMUID, err_thres, 0, 0.075, IMTK_AUTO, IMTK_AUTO); 1.82 1.83 - imtk_label("reflectivity", 280, 20); 1.84 - reflectivity = imtk_slider(IMUID, reflectivity, 0, 1.0, 350, 20); 1.85 + imtk_layout_start(280, 10, 10, IMTK_HORIZONTAL); 1.86 + imtk_label("reflectivity", IMTK_AUTO, IMTK_AUTO); 1.87 + reflectivity = imtk_slider(IMUID, reflectivity, 0, 1.0, IMTK_AUTO, IMTK_AUTO); 1.88 + imtk_layout_newline(); 1.89 + 1.90 + imtk_label("diffuse", IMTK_AUTO, IMTK_AUTO); 1.91 + color.x = color.y = color.z = imtk_slider(IMUID, color.x, 0, 1.0, IMTK_AUTO, IMTK_AUTO); 1.92 1.93 imtk_end(); 1.94 }