Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GUI_H
00017 #define GUI_H
00018
00019 #include <OpenTissue/configuration.h>
00020
00021 #define DEFINE_GLUT_MAIN
00022 #include <OpenTissue/utility/glut/glut_perspective_view_application.h>
00023 #undef DEFINE_GLUT_MAIN
00024
00025 #include "pf_skeleton_tracker.h"
00026 #include "auxil.h"
00027 #include "options.h"
00028 #include "glauxil.h"
00029 #include "opencv_helper.h"
00030
00034 template <class tracker_type>
00035 class TrackerGUI : public OpenTissue::glut::PerspectiveViewApplication
00036 {
00037 protected:
00038 const std::string title;
00039 calibration calib;
00040 tracker_type track;
00041 const bool playback;
00042
00043 public:
00044 TrackerGUI (const std::string _title, const options &opts, const bool _playback)
00045 : title (_title),
00046 calib (opts),
00047 track (opts, calib, _playback),
00048 playback (_playback)
00049 {
00050 this->z_far () = 5000;
00051 }
00052
00053 const char* do_get_title () const
00054 {
00055 return title.c_str ();
00056 }
00057
00058 void do_display ()
00059 {
00060 static bool in_progress = false;
00061 if (in_progress) return;
00062
00063 in_progress = true;
00064 OpenTissue::gl::ColorPicker (0.5, 0.5, 0.5);
00065
00066 track.show ();
00067 in_progress = false;
00068 }
00069
00070 void do_action (unsigned char choice)
00071 {
00072 std::cout << "You pressed " << choice << std::endl;
00073 switch (choice)
00074 {
00075 case 't':
00076 run ();
00077 break;
00078 };
00079 }
00080
00081 void do_init_right_click_menu (int main_menu, void menu (int entry))
00082 {
00083 }
00084
00085 void do_init ()
00086 {
00087 this->camera ().move (80);
00088 glClearColor (0.9, 0.9, 0.9, 0.0);
00089 std::cout << "Press 't' to get going" << std::endl;
00090 }
00091
00092 void do_run ()
00093 {
00094 const bool valid = track.refresh ();
00095 track.prepare_mesh ();
00096 if (valid)
00097 {
00098 display ();
00099 action ('y');
00100 if (!playback)
00101 track.save_states ();
00102 }
00103 else
00104 action (' ');
00105 }
00106
00107 void do_shutdown ()
00108 {
00109 }
00110 };
00111
00112 #endif // GUI_H