- Timestamp:
- 02/28/08 10:15:08 (4 years ago)
- Files:
-
- 1 modified
-
branches/pdfcube-0.0.3/src/pdfcube.cc (modified) (35 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pdfcube-0.0.3/src/pdfcube.cc
r11 r12 25 25 #include <cmath> 26 26 #include <cassert> 27 #include <sstream> 27 28 28 29 // Gtk+ (pkg-config gtk+-2.0) … … 36 37 #include <GL/gl.h> 37 38 #include <GL/glu.h> 39 #include <GL/glx.h> 38 40 39 41 // PDF to GdkPixbuf (pkg-config poppler-glib) … … 48 50 #define DEFAULT_HEIGHT 480 49 51 #define DEFAULT_TITLE "PDF-Cube" 50 52 #define N_FRAMES 30 51 53 #define TIMEOUT_INTERVAL 38 52 54 … … 54 56 // Globals (will be moved inside classes some day) 55 57 56 static gboolean fullscreen = TRUE;57 static gboolean animating = FALSE;58 58 59 59 enum animation { ANIM_NONE, 60 CUBE ,60 CUBE_NEXT, CUBE_PREV, 61 61 ZOOM0, ZOOM1, ZOOM2, ZOOM3, ZOOM4, ZOOMC, 62 62 SWITCH_FW, SWITCH_BW 63 63 }; 64 64 65 66 static gboolean fullscreen = TRUE; 67 static gboolean animating = FALSE; 65 68 animation active_animation = ANIM_NONE; 66 69 animation previous_animation = ANIM_NONE; … … 71 74 // depending on the values in this array 72 75 static bool *page_transition; 73 74 // TODO: customize background color on command line75 static float bgcolor[] = {0.4, 0.0, 0.0};76 static GdkPixbuf* cube_top = NULL;77 78 76 ////////////////////////////////////////////////////////////////////////// 79 77 // Forward declarations 80 78 79 81 80 static void timeout_add (GtkWidget *widget); 82 81 static void timeout_remove (GtkWidget *widget); … … 84 83 static void start_animation (GtkWidget *widget, animation); 85 84 static void stop_animation (GtkWidget *widget); 85 86 86 87 87 static GdkGLConfig *configure_gl (void); … … 116 116 pixmap = 117 117 gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, tex_width, tex_height); 118 steps = new GLfloat[N_FRAMES]; 119 xsteps = new double[N_FRAMES]; 120 zsteps = new double[N_FRAMES]; 121 zoomsteps = new double[N_FRAMES]; 122 perspsteps = new double[N_FRAMES]; 123 perspstepsc = new double[N_FRAMES]; 124 } 125 126 ~pdfcube() 127 { 128 delete []steps; 129 delete []xsteps; 130 delete []zsteps; 131 delete []zoomsteps; 132 delete []perspsteps; 133 delete []perspstepsc; 118 134 } 119 135 … … 121 137 122 138 int pages() { return total_pages; } 123 139 // Cube Normals 140 static GLfloat n[6][3]; 141 // Cube Faces 142 static GLint faces[6][4]; 143 // Cube vertex (filled in pdfcube->initialize()) 144 GLfloat v[8][3]; 145 // Cube texture mapping 146 static GLfloat mapping[6][8]; 147 // Cube Rotation Animation steps (17 frames) 148 // Cube rotation at each frame 149 150 GLfloat *steps; 151 // x camera movement 152 double *xsteps; 153 // z camera movement 154 double *zsteps; 155 double *zoomsteps; 156 double *perspsteps; 157 double *perspstepsc; 158 124 159 void restart(GtkWidget* widget) 125 { current_page = 0; update_textures(widget); } 160 { 161 current_page = 0; update_textures(widget); 162 } 126 163 127 164 void go_to(GtkWidget* widget, int page) … … 154 191 initialize(GtkWidget *widget) 155 192 { 156 glClearColor (bgcolor[0], bgcolor[1], bgcolor[2], 0.0); 193 GLfloat position[] = { 1.0, 1.0, 0.0, 1.0 }; 194 GLfloat local_view[] = { 0.0 }; 157 195 158 // glEnable(GL_NORMALIZE); 159 glShadeModel(GL_FLAT); 196 glShadeModel(GL_SMOOTH); 160 197 glEnable(GL_TEXTURE_RECTANGLE_ARB); 161 198 162 // glEnable(GL_DEPTH_TEST); 163 // or 164 glEnable(GL_CULL_FACE); 199 GLfloat mat_ambient[] = { 0.0, 0.0, 0.0, 1.00 }; 200 GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.00 }; 201 GLfloat mat_shininess[] = { 15.0 }; 202 203 glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); 204 glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); 205 glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); 206 207 glEnable (GL_LIGHTING); 208 glEnable (GL_LIGHT0); 209 glEnable (GL_BLEND); 210 glEnable (GL_CULL_FACE); 211 glEnable (GL_POLYGON_SMOOTH); 212 glPolygonMode (GL_FRONT,GL_FILL); 213 glEdgeFlag(GL_FALSE); 214 215 glClearColor (0.0, 0.0, 0.0, 0.5); 165 216 glCullFace(GL_FRONT); 217 glDisable(GL_DEPTH_TEST); 218 219 glEnable(GL_DEPTH_TEST); 220 glDepthFunc(GL_LEQUAL); 221 glLightfv(GL_LIGHT0, GL_POSITION, position); 222 glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, local_view); 223 224 glFrontFace (GL_CCW); 225 glEnable(GL_LIGHTING); 226 glEnable(GL_LIGHT0); 227 glEnable(GL_AUTO_NORMAL); 228 glEnable(GL_NORMALIZE); 229 glEnable(GL_FOG); 230 { 231 GLfloat fogColor[4] = {0.5, 0.5, 0.5, 0.5}; 232 233 glFogi (GL_FOG_MODE, GL_EXP); 234 glFogi (GL_FOG_START, 0.0); 235 glFogi (GL_FOG_END, 5.0); 236 glFogfv (GL_FOG_COLOR, fogColor); 237 glFogf (GL_FOG_DENSITY, 0.35); 238 glHint (GL_FOG_HINT, GL_DONT_CARE); 239 glClearColor(fogColor[0],fogColor[1],fogColor[2],fogColor[3]); 240 } 166 241 167 242 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); … … 208 283 atx, aty, atz, 209 284 0.0, 1.0, 0.0); // up is in positive Y direction 210 211 }212 213 285 286 matrix_setup(); 287 } 288 214 289 215 290 void 216 291 redraw(GtkWidget *widget) 217 292 { 218 int frames = 17; 293 219 294 double yoffset = 0.1; 220 295 if(animating) … … 227 302 stop_animation(widget); 228 303 break; 229 case CUBE :304 case CUBE_NEXT: 230 305 cerr << "cube " << frame << endl; 231 if(frame == 17)306 if(frame == N_FRAMES) 232 307 { 233 308 frame = 0; 234 309 stop_animation(widget); 310 quick_reset(widget); 235 311 } 236 312 else … … 248 324 } 249 325 break; 250 case ZOOM0:251 cerr << " zoom0" << frame << endl;252 if(frame == 17)326 case CUBE_PREV: 327 cerr << "cube " << frame << endl; 328 if(frame == N_FRAMES) 253 329 { 254 330 frame = 0; 255 331 stop_animation(widget); 332 quick_reset(widget); 333 } 334 else 335 { 336 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 337 glMatrixMode(GL_MODELVIEW); 338 glLoadIdentity(); 339 lookposz -= zsteps[frame]*4; 340 lookposy = 6*xsteps[frame]; 341 gluLookAt(lookposx, lookposy, lookposz, atx,aty,atz, 0,1,0); 342 angle -= steps[frame]; 343 glRotatef(angle, 0.0, -1.0, 0.0); 344 drawCube(); 345 frame++; 346 } 347 break; 348 case ZOOM0: 349 cerr << "zoom0 " << frame << endl; 350 if(frame == N_FRAMES) 351 { 352 frame = 0; 353 stop_animation(widget); 354 quick_reset(widget); 256 355 } 257 356 else … … 261 360 { 262 361 case ZOOM1: 263 persp = perspsteps[ 16-frame];264 atx = lookposx = -(1.3*zoomsteps[ 16-frame]);265 aty = lookposy = zoomsteps[ 16-frame] -266 yoffset/ frames * (16-frame);362 persp = perspsteps[(N_FRAMES-1)-frame]; 363 atx = lookposx = -(1.3*zoomsteps[(N_FRAMES-1)-frame]); 364 aty = lookposy = zoomsteps[(N_FRAMES-1)-frame] - 365 yoffset/N_FRAMES * ((N_FRAMES-1)-frame); 267 366 break; 268 367 case ZOOM2: 269 persp = perspsteps[ 16-frame];270 atx = lookposx = 1.3*zoomsteps[ 16-frame];271 aty = lookposy = zoomsteps[ 16-frame] -272 yoffset/ frames * (16-frame);368 persp = perspsteps[(N_FRAMES-1)-frame]; 369 atx = lookposx = 1.3*zoomsteps[(N_FRAMES-1)-frame]; 370 aty = lookposy = zoomsteps[(N_FRAMES-1)-frame] - 371 yoffset/N_FRAMES * ((N_FRAMES-1)-frame); 273 372 break; 274 373 case ZOOM3: 275 persp = perspsteps[ 16-frame];276 atx = lookposx = -1.3*zoomsteps[ 16-frame];277 aty = lookposy = -zoomsteps[ 16-frame] -278 yoffset/ frames * (16-frame);374 persp = perspsteps[(N_FRAMES-1)-frame]; 375 atx = lookposx = -1.3*zoomsteps[(N_FRAMES-1)-frame]; 376 aty = lookposy = -zoomsteps[(N_FRAMES-1)-frame] - 377 yoffset/N_FRAMES * ((N_FRAMES-1)-frame); 279 378 break; 280 379 case ZOOM4: 281 persp = perspsteps[ 16-frame];282 atx = lookposx = 1.3*zoomsteps[ 16-frame];283 aty = lookposy = -zoomsteps[ 16-frame] -284 yoffset/ frames * (16-frame);380 persp = perspsteps[(N_FRAMES-1)-frame]; 381 atx = lookposx = 1.3*zoomsteps[(N_FRAMES-1)-frame]; 382 aty = lookposy = -zoomsteps[(N_FRAMES-1)-frame] - 383 yoffset/N_FRAMES * ((N_FRAMES-1)-frame); 285 384 break; 286 385 case ZOOMC: 287 persp = perspstepsc[ 16-frame];288 aty = lookposy = - zoomsteps[ 16-frame]*0.38;386 persp = perspstepsc[(N_FRAMES-1)-frame]; 387 aty = lookposy = - zoomsteps[(N_FRAMES-1)-frame]*0.38; 289 388 break; 290 389 default: … … 308 407 case ZOOM1: 309 408 cerr << "zoom1 " << frame << endl; 310 if(frame == 17)409 if(frame == N_FRAMES) 311 410 { 312 411 frame = 0; … … 326 425 glLoadIdentity(); 327 426 atx = lookposx = -1.3*zoomsteps[frame]; 328 aty = lookposy = zoomsteps[frame] - yoffset/ frames* (frame);427 aty = lookposy = zoomsteps[frame] - yoffset/N_FRAMES * (frame); 329 428 gluLookAt(lookposx, lookposy, lookposz, atx, aty, atz, 0,1,0); 330 429 glRotatef(angle, 0.0, 1.0, 0.0); … … 335 434 case ZOOM2: 336 435 cerr << "zoom1 " << frame << endl; 337 if(frame == 17)436 if(frame == N_FRAMES) 338 437 { 339 438 frame = 0; … … 353 452 glLoadIdentity(); 354 453 atx = lookposx = 1.3*zoomsteps[frame]; 355 aty = lookposy = zoomsteps[frame] - yoffset/ frames* (frame);454 aty = lookposy = zoomsteps[frame] - yoffset/N_FRAMES * (frame); 356 455 gluLookAt(lookposx, lookposy, lookposz, atx, aty, atz, 0,1,0); 357 456 glRotatef(angle, 0.0, 1.0, 0.0); … … 362 461 case ZOOM3: 363 462 cerr << "zoom1 " << frame << endl; 364 if(frame == 17)463 if(frame == N_FRAMES) 365 464 { 366 465 frame = 0; … … 380 479 glLoadIdentity(); 381 480 atx = lookposx = -1.3*zoomsteps[frame]; 382 aty = lookposy = -zoomsteps[frame] - yoffset/ frames* (frame);481 aty = lookposy = -zoomsteps[frame] - yoffset/N_FRAMES * (frame); 383 482 gluLookAt(lookposx, lookposy, lookposz, atx, aty, atz, 0,1,0); 384 483 glRotatef(angle, 0.0, 1.0, 0.0); … … 389 488 case ZOOM4: 390 489 cerr << "zoom1 " << frame << endl; 391 if(frame == 17)490 if(frame == N_FRAMES) 392 491 { 393 492 frame = 0; … … 407 506 glLoadIdentity(); 408 507 atx = lookposx = 1.3*zoomsteps[frame]; 409 aty = lookposy = -zoomsteps[frame] -yoffset/ frames* (frame);508 aty = lookposy = -zoomsteps[frame] -yoffset/N_FRAMES * (frame); 410 509 gluLookAt(lookposx, lookposy, lookposz, atx, aty, atz, 0,1,0); 411 510 glRotatef(angle, 0.0, 1.0, 0.0); … … 416 515 case ZOOMC: 417 516 cerr << "zoomc " << frame << endl; 418 if(frame == 17)517 if(frame == N_FRAMES) 419 518 { 420 519 frame = 0; … … 487 586 cerr << "Redrawing" << endl; 488 587 break; 489 case CUBE :588 case CUBE_NEXT: 490 589 cerr << "cube stop" << endl; 491 590 forward(widget); 492 591 current_face = next_face(); 592 // quick_reset(widget); 593 break; 594 case CUBE_PREV: 595 cerr << "cube stop" << endl; 596 backward(widget); 597 current_face = prev_face(); 598 // quick_reset(widget); 493 599 break; 494 600 case SWITCH_FW: … … 515 621 516 622 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 623 // glClear(GL_COLOR_BUFFER_BIT); 517 624 glMatrixMode(GL_PROJECTION); 518 625 glLoadIdentity(); … … 536 643 537 644 cerr << "Ok!" << endl; 538 } 645 glFlush(); 646 } 539 647 } 540 648 … … 571 679 cerr << "Current page: " << current_page << endl; 572 680 } 681 682 void matrix_setup() 683 { 684 /*GLfloat pdfcube::steps[N_FRAMES] = 685 { 2.0, 2.5, 3, 4, 5, 6, 8, 10, 686 14, 10, 8, 6, 4, 3, 2.5, 2.0, 0.0 };*/ 687 688 float step_factor = 0.2*N_FRAMES; //this is little buggy 689 float step = (step_factor)/double(N_FRAMES/2); 690 int i=0; 691 for (i=0;i<N_FRAMES/2;i++) 692 { 693 steps[i]=i*step; 694 if(steps[i]>step_factor) steps[i]=step_factor; 695 } 696 for (i=N_FRAMES/2;i<N_FRAMES;i++) 697 { 698 steps[i]=step_factor-(i-N_FRAMES/2)*step; 699 if(steps[i]<0) steps[i]=0; 700 } 701 steps[N_FRAMES-1]=0; 702 cout << "Step " << step << endl; 703 cout << "Matrix "; 704 for (i=0;i<N_FRAMES;i++) cout << steps[i] << " "; 705 cout << endl; 706 707 /*double pdfcube::xsteps[N_FRAMES] = 708 { 0.01, 0.03, 0.07, 0.12, 0.16, 0.18, 0.20, 0.21, 709 0.21, 0.20, 0.18, 0.16, 0.12, 0.07, 0.03, 0.01, 0.00 };*/ 710 711 float xstep_ratio = 0.4; 712 float xstep = double(xstep_ratio-0.01)/double(N_FRAMES/2); 713 for (i=0;i<N_FRAMES/2;i++) 714 { 715 xsteps[i]=i*xstep; 716 if(xsteps[i]>xstep_ratio) xsteps[i]=xstep_ratio; 717 } 718 for (i=N_FRAMES/2;i<N_FRAMES;i++) 719 { 720 xsteps[i]=xstep_ratio-(i-N_FRAMES/2)*xstep; 721 if(xsteps[i]<0.01) xsteps[i]=0; 722 } 723 xsteps[N_FRAMES-1]=0; 724 725 cout << "Step x " << xstep << endl; 726 cout << "Matrix2 "; 727 for (i=0;i<N_FRAMES;i++) cout << xsteps[i] << " "; 728 cout << endl; 729 730 /*double pdfcube::zsteps[N_FRAMES] = 731 { -0.01, -0.02, -0.04, -0.05, -0.04, -0.02, -0.02, -0.01, 732 0.01, 0.02, 0.02, 0.04, 0.05, 0.04, 0.02, 0.01, 0.00 };*/ 733 734 float granular = 0.07; 735 float zstep = granular/double(N_FRAMES/4); 736 for (i=0;i<N_FRAMES/4;i++) 737 { 738 zsteps[i]=-i*zstep; 739 } 740 for (i=N_FRAMES/4;i<N_FRAMES/2;i++) 741 { 742 zsteps[i]=-granular+(i-N_FRAMES/4)*zstep; 743 } 744 for (i=N_FRAMES/2;i<N_FRAMES;i++) 745 { 746 zsteps[i]=-zsteps[i-N_FRAMES/2]; 747 } 748 zsteps[N_FRAMES-1]=0; 749 cout << "Step z " << zstep << endl; 750 cout << "Matrix3 "; 751 for (i=0;i<N_FRAMES;i++) cout << zsteps[i] << " "; 752 cout << endl; 753 754 /*double pdfcube::zoomsteps[N_FRAMES] = 755 { 0.00, 0.01, 0.02, 0.03, 0.05, 0.07, 0.10, 0.13, 0.17, 756 0.21, 0.25, 0.29, 0.32, 0.35, 0.37, 0.38, 0.38 };*/ 757 758 float zoomstop = 0.38; 759 float zoomstep = (zoomstop/double(N_FRAMES)); 760 for (i=0;i<N_FRAMES;i++) 761 { 762 zoomsteps[i]=i*zoomstep; 763 } 764 zoomsteps[N_FRAMES-1]= zoomstop; 765 cout << "Step zoom " << zoomstep << endl; 766 cout << "Matrix4 "; 767 for (i=0;i<N_FRAMES;i++) cout << zoomsteps[i] << " "; 768 cout << endl; 769 770 /*double pdfcube::perspsteps[N_FRAMES] = 771 { 44.0, 44.0, 44.0, 44.00, 44.00, 43.00, 42.00, 40.00, 772 38.00, 36.00, 33.00, 30.00, 27.00, 24.00, 22.00, 21.00, 21.00 };*/ 773 774 float perspstart = 44.00; 775 float perspstop = 21.00; 776 float perspstep = (perspstart-perspstop)/double(N_FRAMES); 777 for (i=0;i<N_FRAMES;i++) 778 { 779 perspsteps[i]=perspstart-i*perspstep; 780 } 781 perspsteps[0]=perspstart; 782 perspsteps[N_FRAMES-1]=perspstop; 783 cout << "Step persp " << perspstep << endl; 784 cout << "Matrix5 "; 785 for (i=0;i<N_FRAMES;i++) cout << perspsteps[i] << " "; 786 cout << endl; 787 788 789 /*double pdfcube::perspstepsc[N_FRAMES] = 790 { 44.0, 44.0, 44.0, 44.00, 44.00, 43.00, 42.00, 40.00, 791 38.00, 36.00, 34.00, 32.00, 31.00, 30.00, 30.00, 30.00, 30.00 };*/ 792 float perspcstart = 44.00; 793 float perspcstop = 30.00; 794 float perspcstep = (perspcstart-perspcstop)/double(N_FRAMES/2); 795 for (i=0;i<N_FRAMES/4;i++) perspstepsc[i]=perspcstart; 796 797 for (i=N_FRAMES/4;i<3*(N_FRAMES/4);i++) 798 { 799 perspstepsc[i]=perspcstart-i*perspcstep; 800 } 801 for (i=3*(N_FRAMES/4);i<N_FRAMES;i++) perspstepsc[i]=perspcstop; 802 cout << "Step perspc " << perspcstep << endl; 803 cout << "Matrix6 "; 804 for (i=0;i<N_FRAMES;i++) cout << perspstepsc[i] << " "; 805 cout << endl; 806 807 } 573 808 574 809 void … … 597 832 last_animation = ANIM_NONE; 598 833 update_textures(widget); 834 } 835 836 void 837 quick_reset(GtkWidget *widget) 838 { 839 animating = FALSE; 840 frame = 0; 841 lookposx = 0.0; 842 lookposy = 0.0; 843 lookposz = 3.48; 844 atx = 0.0; 845 aty = 0.0; 846 atz = 0.0; 847 persp = 44.0; 848 angle = 0.0; 849 current_face = 0; 850 active_animation = ANIM_NONE; 851 previous_animation = ANIM_NONE; 852 last_animation = ANIM_NONE; 853 // update_textures(widget); 599 854 } 600 855 … … 711 966 static const gint tex_height = (gint)(3*768/2); 712 967 713 // Cube Normals714 static const GLfloat n[6][3];715 // Cube Faces716 static const GLint faces[6][4];717 // Cube vertex (filled in pdfcube->initialize())718 GLfloat v[8][3];719 // Cube texture mapping720 static const GLfloat mapping[6][8];721 // Cube Rotation Animation steps (17 frames)722 // Cube rotation at each frame723 static const GLfloat steps[17];724 // x camera movement725 static const double xsteps[17];726 // z camera movement727 static const double zsteps[17];728 static const double zoomsteps[17];729 static const double perspsteps[17];730 static const double perspstepsc[17];731 968 732 969 void 733 970 render_page(GdkPixbuf* pm, int i, gint iWidth, gint iHeight) 734 971 { 735 PopplerPage *page = NULL;972 PopplerPage *page; 736 973 page = poppler_document_get_page(doc, i); 737 assert(page);738 974 double w, h; 739 975 poppler_page_get_size(page, &w, &h); … … 773 1009 glColor4f(1.0, 1.0, 1.0, 1.0); 774 1010 } 1011 glPolygonMode (GL_FRONT,GL_FILL); 775 1012 glBegin(GL_QUADS); 776 glNormal3fv(&n[i][0]);1013 // glNormal3fv(&n[i][0]); 777 1014 glTexCoord2f((1.0-mapping[i][4]) * tex_width, 778 1015 mapping[i][5] * tex_height); … … 796 1033 }; 797 1034 798 constGLfloat pdfcube::n[6][3] = {1035 GLfloat pdfcube::n[6][3] = { 799 1036 {0.0, 0.0, -1.0}, {1.0, 0.0, 0.0}, {0.0, 0.0, 1.0}, {-1.0, 0.0, 0.0}, 800 1037 {0.0, 1.0, 0.0}, {0.0, -1.0, 0.0} 801 1038 }; 802 constGLint pdfcube::faces[6][4] = {1039 GLint pdfcube::faces[6][4] = { 803 1040 {7, 4, 0, 3}, {7, 6, 5, 4}, {5, 6, 2, 1}, {0, 1, 2, 3}, 804 1041 {3, 2, 6, 7}, {4, 5, 1, 0} 805 1042 }; 806 constGLfloat pdfcube::mapping[6][8] = {1043 GLfloat pdfcube::mapping[6][8] = { 807 1044 {1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0}, 808 1045 {0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0}, … … 812 1049 {1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0}, // bottom 813 1050 }; 814 const GLfloat pdfcube::steps[17] =815 { 2.0, 2.5, 3, 4, 5, 6, 8, 10,816 14, 10, 8, 6, 4, 3, 2.5, 2.0, 0.0 };817 const double pdfcube::xsteps[17] =818 { 0.01, 0.03, 0.07, 0.12, 0.16, 0.18, 0.20, 0.21,819 0.21, 0.20, 0.18, 0.16, 0.12, 0.07, 0.03, 0.01, 0.00 };820 const double pdfcube::zsteps[17] =821 { -0.01, -0.02, -0.04, -0.05, -0.04, -0.02, -0.02, -0.01,822 0.01, 0.02, 0.02, 0.04, 0.05, 0.04, 0.02, 0.01, 0.00 };823 const double pdfcube::zoomsteps[17] =824 { 0.00, 0.01, 0.02, 0.03, 0.05, 0.07, 0.10, 0.13, 0.17,825 0.21, 0.25, 0.29, 0.32, 0.35, 0.37, 0.38, 0.38 };826 const double pdfcube::perspsteps[17] =827 { 44.0, 44.0, 44.0, 44.00, 44.00, 43.00, 42.00, 40.00,828 38.00, 36.00, 33.00, 30.00, 27.00, 24.00, 22.00, 21.00, 21.00 };829 const double pdfcube::perspstepsc[17] =830 { 44.0, 44.0, 44.0, 44.00, 44.00, 43.00, 42.00, 40.00,831 38.00, 36.00, 34.00, 32.00, 31.00, 30.00, 30.00, 30.00, 30.00 };832 1051 833 1052 pdfcube* pc; 1053 1054 834 1055 835 1056 ////////////////////////////////////////////////////////////////////////// … … 1100 1321 // Animated Cube Advancement 1101 1322 case GDK_a: 1323 g_print ("a key\n"); 1324 if(sleeping()) 1325 start_animation(widget, CUBE_PREV); 1326 1327 break; 1102 1328 case GDK_c: 1103 1329 g_print ("c key\n"); 1104 1330 if(sleeping()) 1105 start_animation(widget, CUBE );1331 start_animation(widget, CUBE_NEXT); 1106 1332 break; 1107 1333 … … 1174 1400 case GDK_space: 1175 1401 if(page_transition[pc->page()] and sleeping()) 1176 start_animation(widget, CUBE );1402 start_animation(widget, CUBE_NEXT); 1177 1403 else if(sleeping()) 1178 1404 start_animation(widget, SWITCH_FW); … … 1415 1641 glconfig = gdk_gl_config_new_by_mode ((GdkGLConfigMode) 1416 1642 ( 1417 GDK_GL_MODE_RGB | 1643 GDK_GL_MODE_RGBA | 1644 GDK_GL_MODE_ALPHA | 1645 GDK_GL_MODE_RGB | 1418 1646 GDK_GL_MODE_DEPTH | 1419 1647 GDK_GL_MODE_DOUBLE)); … … 1500 1728 cerr << "Errore nel nome del file" << endl; 1501 1729 } 1502 1503 GError* g = NULL;1504 1730 PopplerDocument* document = 1505 poppler_document_new_from_file(filename_uri, NULL, &g); 1506 1507 if(g && g->code) 1508 { 1509 perror(g->message); 1510 exit(2); 1511 } 1731 poppler_document_new_from_file(filename_uri, NULL, NULL); 1512 1732 1513 1733 if(document == NULL)

