00001 #ifndef GL_BOX_H
00002 #define GL_BOX_H
00003
00004 #include <iostream>
00005 #include <stdio.h>
00006 #include <stdlib.h>
00007 #include <string.h>
00008 #include <unistd.h>
00009 #include <math.h>
00010 #include <time.h>
00011 #include <sys/time.h>
00012 #include "movie.h"
00013 #include "drawable.h"
00014 #include "arcball.h"
00015
00016 #ifdef GRAPHICS
00017 #include <FL/Fl.h>
00018 #include <FL/Fl_Window.h>
00019 #include <FL/Fl_Slider.h>
00020 #include <FL/Fl_Roller.h>
00021 #include <FL/Fl_Gl_Window.h>
00022 #include <FL/gl.h>
00023 #include <FL/glut.h>
00024 #include <GL/glu.h>
00025 #endif
00026
00056 class gl_box : public Fl_Gl_Window
00057 {
00058 public:
00066 movie *m;
00067
00077 double eye[3];
00078
00082 double focus[3];
00083
00087 double min_coords[3];
00088
00092 double max_coords[3];
00093
00098 double max_diff;
00099
00106 ap_array<drawable> *objects;
00107
00115 ap_array<gl_cylinder_f> *gl_cylinders;
00116
00120 ap_array<gl_cylinder_s> *short_gl_cylinders;
00121
00126 ap_array<byte> *pixels;
00127
00131 double distance;
00132
00137 double near_percent;
00138
00143 double far_percent;
00144
00145 bool rotating;
00146 int wobble;
00147 double wobble_theta;
00148 timeval wobble_start;
00149 timeval now;
00150
00151 bool full;
00152 bool stereo;
00153 bool cross_eyed;
00154
00155 double eye_separation;
00163 int spin_rate;
00164 double spin;
00165 timeval last_spin;
00166
00167 int save_detail;
00168 double save_delay;
00169
00170 int mouse_start_x;
00171 int mouse_start_y;
00172 int mouse_x;
00173 int mouse_y;
00174 Arcball *a;
00175 Arcball *light_arcball;
00176 ap_color bg_color;
00177 bool stop;
00178 bool lights;
00179 bool blend;
00180 bool axes;
00181 bool box;
00182 bool save_frame;
00183 int save_movie;
00184 char *ppm_file;
00185 const char *ppm_prefix;
00186 int detail;
00187 GLUquadricObj *qobj;
00188 int sphere_lists;
00189 int cylinder_lists;
00190
00199 int highlight;
00200
00201 bool quash;
00202
00211 bool need_to_copy;
00212
00217 const static double theta=0.00025;
00218
00229 void set_limits ( double min_coords[3], double max_coords[3] );
00230
00240 void reset_view();
00241
00252 void set_stereo ( int option );
00253
00259 void draw_axes();
00260
00264 void draw_box();
00265
00271 void copy_image_to_ppm();
00272
00284 void add_to_color ( int i, int amount );
00285
00289 void set_movie ( movie *m );
00290
00298 void draw();
00299
00305 void draw_frame(bool left);
00306
00314 void gl_init();
00315
00327 template <class T, class S>
00328 void draw ( sphere<T,S> *s );
00329
00342 template <class T, class S>
00343 void draw ( gl_cylinder<T,S> *c );
00344
00353 int handle ( int event );
00354
00368 gl_box ( int x, int y, int w, int h, const char *label=0 );
00369 };
00370
00371 #endif