rayfract

view 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 source
1 #include <stdio.h>
2 #include <math.h>
4 #ifndef __APPLE__
5 #include <GL/glut.h>
6 #else
7 #include <GLUT/glut.h>
8 #endif
10 #include <imtk.h>
11 #include "gui.h"
12 #include "sdr.h"
13 #include "vmath.h"
15 static int show_gui = 1;
16 static float fiter = 10;
18 extern unsigned int sdr;
19 extern Vector4 seed;
20 extern int iter;
21 extern float err_thres;
22 extern float reflectivity;
23 extern Vector3 color;
25 int gui_init(int width, int height)
26 {
27 imtk_set_viewport(width, height);
28 imtk_set_alpha(0.5);
29 return 0;
30 }
32 void gui_draw()
33 {
35 if(!show_gui) {
36 return;
37 }
39 imtk_begin();
40 imtk_layout_start(10, 10, 10, IMTK_HORIZONTAL);
42 imtk_label("seed x", IMTK_AUTO, IMTK_AUTO);
43 seed.x = imtk_slider(IMUID, seed.x, -1.0, 1.0, IMTK_AUTO, IMTK_AUTO);
44 imtk_layout_newline();
46 imtk_label("seed y", IMTK_AUTO, IMTK_AUTO);
47 seed.y = imtk_slider(IMUID, seed.y, -1.0, 1.0, IMTK_AUTO, IMTK_AUTO);
48 imtk_layout_newline();
50 imtk_label("seed z", IMTK_AUTO, IMTK_AUTO);
51 seed.z = imtk_slider(IMUID, seed.z, -1.0, 1.0, IMTK_AUTO, IMTK_AUTO);
52 imtk_layout_newline();
54 imtk_label("seed w", IMTK_AUTO, IMTK_AUTO);
55 seed.w = imtk_slider(IMUID, seed.w, -2.0, 2.0, IMTK_AUTO, IMTK_AUTO);
56 imtk_layout_newline();
58 imtk_label("iterations", IMTK_AUTO, IMTK_AUTO);
59 fiter = imtk_slider(IMUID, fiter, 0, 32, IMTK_AUTO, IMTK_AUTO);
60 iter = round(fiter);
61 imtk_layout_newline();
63 imtk_label("max error", IMTK_AUTO, IMTK_AUTO);
64 err_thres = imtk_slider(IMUID, err_thres, 0, 0.075, IMTK_AUTO, IMTK_AUTO);
66 imtk_layout_start(280, 10, 10, IMTK_HORIZONTAL);
67 imtk_label("reflectivity", IMTK_AUTO, IMTK_AUTO);
68 reflectivity = imtk_slider(IMUID, reflectivity, 0, 1.0, IMTK_AUTO, IMTK_AUTO);
69 imtk_layout_newline();
71 imtk_label("diffuse", IMTK_AUTO, IMTK_AUTO);
72 color.x = color.y = color.z = imtk_slider(IMUID, color.x, 0, 1.0, IMTK_AUTO, IMTK_AUTO);
74 imtk_end();
75 }
77 void gui_set_visible(bool vis)
78 {
79 show_gui = vis;
80 }