// copyright Min Zhong, cs838 proj2, April, 2000 #include "viewer.h" #include "RunButton.h" // init an input but's label align and assign init val void init_int_input_button(Fl_Int_Input *b, int align, int init_val) { char s_val[10]; _itoa(init_val, s_val, 10); b->align(align); b->when(FL_WHEN_ENTER_KEY); // call back on enter b->value(s_val); } // the main routine makes the window, and then runs an even loop // until the window is closed int main() { Gl_Win *gl; int w, h, gl_w, gl_h, x1, x2, x3, x4, x5, x2_5, y2, y3, y4; w = 920; h = 650; gl_w = 720; gl_h = 480; x1 = 200; x2 = 300; x2_5 = 400; x3 = 680; x4 = gl_w + 30; // col rt of glwin x5 = x4 + 20; y2 = gl_h + 20; // row below glwin y3 = y2 + 50; // row below y2 y4 = y3 + 30; // row below y3 //Fl_Double_Window* wind = new Fl_Double_Window(100,100,w,h, "GL Motion Capture:"); Panel* wind = new Panel(100,100,w,h); wind->begin(); // put widgets inside of the window wind->gl = new Gl_Win(10,10,720, 480); gl = wind->gl; // open motion file wind->in_motion_fileB = new Fl_Button(x4, 10, 150, 30, "Load Motion"); // open marker request file Fl_Button *in_marker_fileB = new Fl_Button(x4, 60, 150, 30, "Load Marker Request"); // export marker position file Fl_Button *out_marker_fileB = new Fl_Button(x4, 100, 150, 30, "Export Markers"); RunSlider* rt = new RunSlider(gl, gl->frame_cnt, x2, y2, 430,30); gl->timeS = rt; gl->runBut = new RunButton(rt,50, y2, 80,30, gl->frame_time, gl->play_mode); Fl_Round_Button *play_modeB = new Fl_Round_Button(x1-20, y2, 50, 30, "Play Real Time"); play_modeB->value(gl->play_mode); // auto key eveyr nth frame wind->key_nthB = new Fl_Int_Input(50, y3, 40, 25, "key nth"); init_int_input_button(wind->key_nthB, FL_ALIGN_RIGHT, 0); // manually key this frame wind->key_addB = new Fl_Round_Button(50, y4, 50, 30, "key this frame"); // manually un-key this frame wind->key_rmvB = new Fl_Round_Button(50, y4+30, 50, 30, "un-key this frame" ); // print all keys Fl_Round_Button *key_printB = new Fl_Round_Button(x1, y4, 50, 30, "Display keys"); // clear all keys Fl_Round_Button *key_clearB = new Fl_Round_Button(x1, y4+30, 50, 30, "clear ALL keys"); // user specify which frame to start interp/show wind->beginB = new Fl_Int_Input(x2, y3, 50, 25, "Start Frame"); init_int_input_button(wind->beginB, FL_ALIGN_TOP, gl->begin); // last frame to be shown wind->endB = new Fl_Int_Input(x3, y3, 50, 25, "End"); init_int_input_button(wind->endB, FL_ALIGN_TOP, gl->end); // light Fl_Light_Button *lightB = new Fl_Light_Button(x3, y4, 60, 25, "light"); lightB->value(1); // draw floor Fl_Light_Button *floorB = new Fl_Light_Button(x3, y4+30, 60, 25, "floor"); floorB->value(1); // endsite selection gl->endsite_browser = new Fl_Multi_Browser(x2_5, y3, 200, 80, "Trace endsites"); gl->endsite_browser->align(FL_ALIGN_TOP); // Euler interp options Fl_Hold_Browser *euler_browser = new Fl_Hold_Browser(x5, 160, 100, 80, "Euler Interp"); wind->euler_browser = euler_browser; euler_browser->align(FL_ALIGN_TOP); euler_browser->add("Hide", 0); euler_browser->add("None", 0); euler_browser->add("Linear", 0); euler_browser->add("Cardinal", 0); euler_browser->value(2); // Quaternion interp options Fl_Hold_Browser *quat_browser = new Fl_Hold_Browser(x5, 270, 100, 80, "Quat Interp"); wind->quat_browser = quat_browser; quat_browser->align(FL_ALIGN_TOP); quat_browser->add("Hide", 0); quat_browser->add("None", 0); quat_browser->add("Slerp", 0); quat_browser->add("Quat Berzier", 0); quat_browser->value(2); // Expmap interp options Fl_Hold_Browser *emap_browser = new Fl_Hold_Browser(x5, 380, 100, 80, "emap Interp"); wind->emap_browser = emap_browser; emap_browser->align(FL_ALIGN_TOP); emap_browser->add("Hide", 0); emap_browser->add("None", 0); emap_browser->add("Slerp", 0); emap_browser->add("Linear", 0); emap_browser->value(1); Fl_Hold_Browser *marker_type_browser = new Fl_Hold_Browser(x5, 490, 100, 60, "marker type"); marker_type_browser->align(FL_ALIGN_TOP); marker_type_browser->add("EULER", 0); marker_type_browser->add("QUAT", 0); marker_type_browser->add("EXPMAP", 0); marker_type_browser->value(1); // camera options Fl_Hold_Browser *camera_browser = new Fl_Hold_Browser(x5, 580, 100, 55, "Camera Views"); camera_browser->align(FL_ALIGN_TOP); camera_browser->add("Omnicient", 0); camera_browser->add("Smart follow", 0); camera_browser->value(OMIN); wind->in_motion_fileB->callback((Fl_Callback*)in_motion_fileCB, wind); in_marker_fileB->callback((Fl_Callback*)in_marker_fileCB, gl); out_marker_fileB->callback((Fl_Callback*)out_marker_fileCB, gl); gl->timeS->callback((Fl_Callback*)runSliderCB, wind); gl->runBut->callback((Fl_Callback *)runCB, gl); play_modeB->callback((Fl_Callback *)play_modeCB, gl); wind->key_nthB->callback((Fl_Callback*)key_nthCB, wind); wind->key_addB->callback((Fl_Callback*)key_addCB, wind); wind->key_rmvB->callback((Fl_Callback*)key_rmvCB, wind); key_clearB->callback((Fl_Callback*)key_clearCB, wind); key_printB->callback((Fl_Callback*)key_printCB, gl); wind->beginB->callback((Fl_Callback*)beginCB, gl); wind->endB->callback((Fl_Callback*)endCB, gl); lightB->callback((Fl_Callback*)lightCB, gl); floorB->callback((Fl_Callback*)floorCB, gl); camera_browser->callback((Fl_Callback *)camera_browserCB, gl); euler_browser->callback((Fl_Callback *)euler_browserCB, gl); quat_browser->callback((Fl_Callback *)quat_browserCB, gl); emap_browser->callback((Fl_Callback *)emap_browserCB, gl); marker_type_browser->callback((Fl_Callback *)marker_rotType_browserCB, gl); gl->endsite_browser->callback((Fl_Callback *)marker_sel_browserCB, gl); wind->end(); wind->show(); // this actually opens the window Fl::run(); delete wind; return 1; }