Changeset 1340 for trunk/source/visualization/externals/gl2ps
- Timestamp:
- Nov 5, 2010, 3:45:55 PM (14 years ago)
- Location:
- trunk/source/visualization/externals/gl2ps
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/externals/gl2ps/CVS/Entries
r1337 r1340 3 3 /CMakeLists.txt/1.1/Wed Sep 29 19:14:00 2010// 4 4 /GNUmakefile/1.5/Thu Sep 30 06:17:28 2010// 5 /History/1.16/Thu Sep 30 06:17:28 2010//6 5 /sources.cmake/1.1/Wed Sep 29 19:14:08 2010// 6 /History/1.18/Wed Nov 3 16:40:34 2010// -
trunk/source/visualization/externals/gl2ps/History
r1246 r1340 1 $Id: History,v 1.1 6 2010/04/26 16:28:18lgarnier Exp $1 $Id: History,v 1.18 2010/11/03 16:40:34 lgarnier Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 17 17 * Reverse chronological order (last date on top), please * 18 18 ---------------------------------------------------------- 19 20 21 3rd November 2010, Laurent Garnier 22 - Update gl2ps to 1.3.5 (before it was 1.3.3) 23 24 6th October 2010, John Allison (visexternal-V09-03-00) 25 - Tagged. 19 26 20 27 26th April 2010, Laurent Garnier -
trunk/source/visualization/externals/gl2ps/include/CVS/Entries
r1337 r1340 1 1 /G4OpenGL2PSAction.hh/1.4/Thu Sep 30 06:17:28 2010// 2 /Geant4_gl2ps.h/1. 2/Mon Jul 12 14:53:172010//3 /gl2ps.h/1. 2/Mon Jul 12 14:53:172010//2 /Geant4_gl2ps.h/1.3/Wed Nov 3 15:19:14 2010// 3 /gl2ps.h/1.3/Wed Nov 3 16:40:15 2010// 4 4 D -
trunk/source/visualization/externals/gl2ps/include/Geant4_gl2ps.h
r937 r1340 27 27 #define Geant4_gl2ps_h 28 28 29 // gl2ps-1.3. 329 // gl2ps-1.3.5 30 30 // The gl2ps code is prefixed by Geant4_ in order 31 31 // to avoid clashes with other gl2ps code that may come at link -
trunk/source/visualization/externals/gl2ps/include/gl2ps.h
r937 r1340 53 53 * to provide one. 54 54 * 55 * For the latest info about gl2ps, see http://www.geuz.org/gl2ps/. 55 * For the latest info about gl2ps and a full list of contributors, 56 * see http://www.geuz.org/gl2ps/. 57 * 56 58 * Please report all bugs and problems to <gl2ps@geuz.org>. 57 59 */ … … 68 70 # if defined(_MSC_VER) 69 71 # pragma warning(disable:4115) 72 # pragma warning(disable:4996) 70 73 # endif 71 74 # include <windows.h> … … 103 106 #define GL2PS_MAJOR_VERSION 1 104 107 #define GL2PS_MINOR_VERSION 3 105 #define GL2PS_PATCH_VERSION 3108 #define GL2PS_PATCH_VERSION 5 106 109 #define GL2PS_EXTRA_VERSION "" 107 110 -
trunk/source/visualization/externals/gl2ps/src/CVS/Entries
r1337 r1340 1 /G4OpenGL2PSAction.cc/1. 5/Thu Sep 30 06:17:282010//2 /gl2ps.cc/1. 8/Thu Sep 30 06:17:312010//1 /G4OpenGL2PSAction.cc/1.6/Wed Nov 3 16:40:34 2010// 2 /gl2ps.cc/1.9/Wed Nov 3 15:22:18 2010// 3 3 D -
trunk/source/visualization/externals/gl2ps/src/G4OpenGL2PSAction.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4OpenGL2PSAction.cc,v 1. 5 2010/04/26 16:28:18lgarnier Exp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4OpenGL2PSAction.cc,v 1.6 2010/11/03 16:40:34 lgarnier Exp $ 28 // GEANT4 tag $Name: $ 29 29 // 30 30 // … … 139 139 if(!fFile) return; 140 140 int options = GL2PS_OCCLUSION_CULL | 141 GL2PS_BEST_ROOT | GL2PS_SILENT | GL2PS_DRAW_BACKGROUND; 141 GL2PS_BEST_ROOT | GL2PS_SILENT | GL2PS_DRAW_BACKGROUND | GL2PS_USE_CURRENT_VIEWPORT; 142 // int options = GL2PS_OCCLUSION_CULL | 143 // GL2PS_BEST_ROOT | GL2PS_SILENT | GL2PS_DRAW_BACKGROUND; 142 144 int sort = GL2PS_BSP_SORT; 143 145 //int sort = GL2PS_SIMPLE_SORT; -
trunk/source/visualization/externals/gl2ps/src/gl2ps.cc
r1228 r1340 62 62 * to provide one. 63 63 * 64 * Contributors: 65 * Michael Sweet <mike@easysw.com> 66 * Marc Ume <marc.ume@digitalgraphics.be> 67 * Jean-Francois Remacle <remacle@gce.ucl.ac.be> 68 * Bart Kaptein <B.L.Kaptein@lumc.nl> 69 * Quy Nguyen-Dai <quy@nguyendai.org> 70 * Sam Buss <sbuss@ucsd.edu> 71 * Shane Hill <Shane.Hill@dsto.defence.gov.au> 72 * Romain Boman <r_boman@yahoo.fr> 73 * Rouben Rostamian <rostamian@umbc.edu> 74 * Diego Santa Cruz <Diego.SantaCruz@epfl.ch> 75 * Shahzad Muzaffar <Shahzad.Muzaffar@cern.ch> 76 * Lassi Tuura <lassi.tuura@cern.ch> 77 * Guy Barrand <barrand@lal.in2p3.fr> 78 * Prabhu Ramachandran <prabhu@aero.iitm.ernet.in> 79 * Micha Bieber <bieber@traits.de> 80 * Olivier Couet <couet@mail.cern.ch> 81 * Shai Ayal <shaiay@gmail.com> 82 * Fabian Wenzel <wenzel@tu-harburg.de> 83 * Ian D. Gay <gay@sfu.ca> 84 * Cosmin Truta <cosmin@cs.toronto.edu> 85 * Baiju Devani <b.devani@gmail.com> 86 * Alexander Danilov <danilov@lanl.gov> 64 * For the latest info about gl2ps and a full list of contributors, 65 * see http://www.geuz.org/gl2ps/. 87 66 * 88 * For the latest info about gl2ps, see http://www.geuz.org/gl2ps/.89 67 * Please report all bugs and problems to <gl2ps@geuz.org>. 90 68 */ … … 92 70 #include "Geant4_gl2ps.h" 93 71 94 #include < cmath>72 #include <math.h> 95 73 #include <string.h> 96 74 #include <sys/types.h> … … 119 97 #define GL2PS_ZOFFSET 5.0e-2F 120 98 #define GL2PS_ZOFFSET_LARGE 20.0F 121 #define GL2PS_ZERO(arg) ( std::fabs(arg) < 1.e-20)99 #define GL2PS_ZERO(arg) (fabs(arg) < 1.e-20) 122 100 123 101 /* Primitive types */ … … 349 327 void *ptr; 350 328 351 if(!size) return (NULL);329 if(!size) return NULL; 352 330 ptr = malloc(size); 353 331 if(!ptr){ 354 332 gl2psMsg(GL2PS_ERROR, "Couldn't allocate requested memory"); 355 exit(1);356 } 357 return (ptr);333 return NULL; 334 } 335 return ptr; 358 336 } 359 337 360 338 static void *gl2psRealloc(void *ptr, size_t size) 361 339 { 362 if(!size) return (NULL);340 if(!size) return NULL; 363 341 ptr = realloc(ptr, size); 364 342 if(!ptr){ 365 343 gl2psMsg(GL2PS_ERROR, "Couldn't reallocate requested memory"); 366 exit(1);367 } 368 return (ptr);344 return NULL; 345 } 346 return ptr; 369 347 } 370 348 … … 589 567 list->array = NULL; 590 568 gl2psListRealloc(list, n); 591 return (list);569 return list; 592 570 } 593 571 … … 620 598 if(!list) 621 599 return 0; 622 return (list->n);600 return list->n; 623 601 } 624 602 … … 633 611 return NULL; 634 612 } 635 return (&list->array[index * list->size]);613 return &list->array[index * list->size]; 636 614 } 637 615 … … 747 725 748 726 for(i = 1; i < n; i++){ 749 if( std::fabs(rgba[0][0] - rgba[i][0]) > threshold[0] ||750 std::fabs(rgba[0][1] - rgba[i][1]) > threshold[1] ||751 std::fabs(rgba[0][2] - rgba[i][2]) > threshold[2])727 if(fabs(rgba[0][0] - rgba[i][0]) > threshold[0] || 728 fabs(rgba[0][1] - rgba[i][1]) > threshold[1] || 729 fabs(rgba[0][2] - rgba[i][2]) > threshold[2]) 752 730 return GL_FALSE; 753 731 } … … 1105 1083 static GLfloat gl2psComparePointPlane(GL2PSxyz point, GL2PSplane plane) 1106 1084 { 1107 return (plane[0] * point[0] +1108 plane[1] * point[1] +1109 plane[2] * point[2] +1110 plane[3]);1085 return (plane[0] * point[0] + 1086 plane[1] * point[1] + 1087 plane[2] * point[2] + 1088 plane[3]); 1111 1089 } 1112 1090 1113 1091 static GLfloat gl2psPsca(GLfloat *a, GLfloat *b) 1114 1092 { 1115 return (a[0]*b[0] + a[1]*b[1] + a[2]*b[2]);1093 return (a[0]*b[0] + a[1]*b[1] + a[2]*b[2]); 1116 1094 } 1117 1095 … … 1451 1429 q = *(GL2PSprimitive**)a; 1452 1430 w = *(GL2PSprimitive**)b; 1453 return (q->type < w->type ? 1 : -1);1431 return (q->type < w->type ? 1 : -1); 1454 1432 } 1455 1433 … … 1499 1477 } 1500 1478 1501 static void gl2psFreeImagemap(GL2PSimagemap *list){ 1479 static void gl2psFreeImagemap(GL2PSimagemap *list) 1480 { 1502 1481 GL2PSimagemap *next; 1503 1482 while(list != NULL){ … … 2393 2372 current += 2; used -= 2; 2394 2373 node->image->height = (GLint)current[2]; 2395 prim->verts[0].xyz[0] = prim->verts[0].xyz[0] - (int)(node->image->width / 2) + 0.5 ;2396 prim->verts[0].xyz[1] = prim->verts[0].xyz[1] - (int)(node->image->height / 2) + 0.5 ;2374 prim->verts[0].xyz[0] = prim->verts[0].xyz[0] - (int)(node->image->width / 2) + 0.5F; 2375 prim->verts[0].xyz[1] = prim->verts[0].xyz[1] - (int)(node->image->height / 2) + 0.5F; 2397 2376 for(i = 1; i < 4; i++){ 2398 2377 for(v = 0; v < 3; v++){ … … 2490 2469 for(col = 0; col < width; col++){ 2491 2470 gl2psGetRGB(im, col, row, &dr, &dg, &db); 2492 fgrey = (0.30 * dr + 0.59 * dg + 0.11* db);2471 fgrey = (0.30F * dr + 0.59F * dg + 0.11F * db); 2493 2472 grey = (unsigned char)(255. * fgrey); 2494 2473 gl2psWriteByte(grey); … … 3353 3332 } 3354 3333 3355 static void gl2psPrintTeXBeginViewport(GLint [4])3334 static void gl2psPrintTeXBeginViewport(GLint viewport[4]) 3356 3335 { 3357 3336 glRenderMode(GL_FEEDBACK); … … 3446 3425 static void gl2psPutPDFText(GL2PSstring *text, int cnt, GLfloat x, GLfloat y) 3447 3426 { 3448 gl2ps->streamlength += 3449 gl2psPrintf("BT\n" 3450 "/F%d %d Tf\n" 3451 "%f %f Td\n" 3452 "(%s) Tj\n" 3453 "ET\n", 3454 cnt, text->fontsize, x, y, text->str); 3427 GLfloat rad, crad, srad; 3428 3429 if(text->angle == 0.0F){ 3430 gl2ps->streamlength += gl2psPrintf 3431 ("BT\n" 3432 "/F%d %d Tf\n" 3433 "%f %f Td\n" 3434 "(%s) Tj\n" 3435 "ET\n", 3436 cnt, text->fontsize, x, y, text->str); 3437 } 3438 else{ 3439 rad = M_PI * text->angle / 180.0F; 3440 srad = (GLfloat)sin(rad); 3441 crad = (GLfloat)cos(rad); 3442 gl2ps->streamlength += gl2psPrintf 3443 ("BT\n" 3444 "/F%d %d Tf\n" 3445 "%f %f %f %f %f %f Tm\n" 3446 "(%s) Tj\n" 3447 "ET\n", 3448 cnt, text->fontsize, crad, srad, -srad, crad, x, y, text->str); 3449 } 3455 3450 } 3456 3451 3457 3452 static void gl2psPutPDFImage(GL2PSimage *image, int cnt, GLfloat x, GLfloat y) 3458 3453 { 3459 gl2ps->streamlength += 3460 gl2psPrintf("q\n"3461 3462 3463 3464 3454 gl2ps->streamlength += gl2psPrintf 3455 ("q\n" 3456 "%d 0 0 %d %f %f cm\n" 3457 "/Im%d Do\n" 3458 "Q\n", 3459 (int)image->width, (int)image->height, x, y, cnt); 3465 3460 } 3466 3461 … … 4526 4521 int gray) 4527 4522 { 4528 int x, y ;4523 int x, y, shift; 4529 4524 GLfloat r, g, b, a; 4530 4525 … … 4532 4527 return 0; 4533 4528 4534 if(gray && gray != 8 && gray != 16)4529 if(gray && gray != 8 && gray != 16) 4535 4530 gray = 8; 4536 4531 4537 4532 gray /= 8; 4538 4533 4534 shift = (sizeof(unsigned long) - 1) * 8; 4535 4539 4536 for(y = 0; y < im->height; ++y){ 4540 4537 for(x = 0; x < im->width; ++x){ 4541 4538 a = gl2psGetRGB(im, x, y, &r, &g, &b); 4542 4539 if(im->format == GL_RGBA && gray){ 4543 (*action)((unsigned long)(a *255) << 24, gray);4540 (*action)((unsigned long)(a * 255) << shift, gray); 4544 4541 } 4545 4542 else{ 4546 (*action)((unsigned long)(r *255) << 24, 1);4547 (*action)((unsigned long)(g *255) << 24, 1);4548 (*action)((unsigned long)(b *255) << 24, 1);4543 (*action)((unsigned long)(r * 255) << shift, 1); 4544 (*action)((unsigned long)(g * 255) << shift, 1); 4545 (*action)((unsigned long)(b * 255) << shift, 1); 4549 4546 } 4550 4547 } … … 4962 4959 for(i = 0; i < 3; i++){ 4963 4960 xyz2[0][i] = xyz[0][i]; 4964 xyz2[1][i] = 0.5 * (xyz[0][i] + xyz[1][i]);4965 xyz2[2][i] = 0.5 * (xyz[0][i] + xyz[2][i]);4961 xyz2[1][i] = 0.5F * (xyz[0][i] + xyz[1][i]); 4962 xyz2[2][i] = 0.5F * (xyz[0][i] + xyz[2][i]); 4966 4963 } 4967 4964 for(i = 0; i < 4; i++){ 4968 4965 rgba2[0][i] = rgba[0][i]; 4969 rgba2[1][i] = 0.5 * (rgba[0][i] + rgba[1][i]);4970 rgba2[2][i] = 0.5 * (rgba[0][i] + rgba[2][i]);4966 rgba2[1][i] = 0.5F * (rgba[0][i] + rgba[1][i]); 4967 rgba2[2][i] = 0.5F * (rgba[0][i] + rgba[2][i]); 4971 4968 } 4972 4969 gl2psPrintSVGSmoothTriangle(xyz2, rgba2); 4973 4970 for(i = 0; i < 3; i++){ 4974 xyz2[0][i] = 0.5 * (xyz[0][i] + xyz[1][i]);4971 xyz2[0][i] = 0.5F * (xyz[0][i] + xyz[1][i]); 4975 4972 xyz2[1][i] = xyz[1][i]; 4976 xyz2[2][i] = 0.5 * (xyz[1][i] + xyz[2][i]);4973 xyz2[2][i] = 0.5F * (xyz[1][i] + xyz[2][i]); 4977 4974 } 4978 4975 for(i = 0; i < 4; i++){ 4979 rgba2[0][i] = 0.5 * (rgba[0][i] + rgba[1][i]);4976 rgba2[0][i] = 0.5F * (rgba[0][i] + rgba[1][i]); 4980 4977 rgba2[1][i] = rgba[1][i]; 4981 rgba2[2][i] = 0.5 * (rgba[1][i] + rgba[2][i]);4978 rgba2[2][i] = 0.5F * (rgba[1][i] + rgba[2][i]); 4982 4979 } 4983 4980 gl2psPrintSVGSmoothTriangle(xyz2, rgba2); 4984 4981 for(i = 0; i < 3; i++){ 4985 xyz2[0][i] = 0.5 * (xyz[0][i] + xyz[2][i]);4982 xyz2[0][i] = 0.5F * (xyz[0][i] + xyz[2][i]); 4986 4983 xyz2[1][i] = xyz[2][i]; 4987 xyz2[2][i] = 0.5 * (xyz[1][i] + xyz[2][i]);4984 xyz2[2][i] = 0.5F * (xyz[1][i] + xyz[2][i]); 4988 4985 } 4989 4986 for(i = 0; i < 4; i++){ 4990 rgba2[0][i] = 0.5 * (rgba[0][i] + rgba[2][i]);4987 rgba2[0][i] = 0.5F * (rgba[0][i] + rgba[2][i]); 4991 4988 rgba2[1][i] = rgba[2][i]; 4992 rgba2[2][i] = 0.5 * (rgba[1][i] + rgba[2][i]);4989 rgba2[2][i] = 0.5F * (rgba[1][i] + rgba[2][i]); 4993 4990 } 4994 4991 gl2psPrintSVGSmoothTriangle(xyz2, rgba2); 4995 4992 for(i = 0; i < 3; i++){ 4996 xyz2[0][i] = 0.5 * (xyz[0][i] + xyz[1][i]);4997 xyz2[1][i] = 0.5 * (xyz[1][i] + xyz[2][i]);4998 xyz2[2][i] = 0.5 * (xyz[0][i] + xyz[2][i]);4993 xyz2[0][i] = 0.5F * (xyz[0][i] + xyz[1][i]); 4994 xyz2[1][i] = 0.5F * (xyz[1][i] + xyz[2][i]); 4995 xyz2[2][i] = 0.5F * (xyz[0][i] + xyz[2][i]); 4999 4996 } 5000 4997 for(i = 0; i < 4; i++){ 5001 rgba2[0][i] = 0.5 * (rgba[0][i] + rgba[1][i]);5002 rgba2[1][i] = 0.5 * (rgba[1][i] + rgba[2][i]);5003 rgba2[2][i] = 0.5 * (rgba[0][i] + rgba[2][i]);4998 rgba2[0][i] = 0.5F * (rgba[0][i] + rgba[1][i]); 4999 rgba2[1][i] = 0.5F * (rgba[1][i] + rgba[2][i]); 5000 rgba2[2][i] = 0.5F * (rgba[0][i] + rgba[2][i]); 5004 5001 } 5005 5002 gl2psPrintSVGSmoothTriangle(xyz2, rgba2); … … 5035 5032 } 5036 5033 5037 #if defined(GL2PS_HAVE_LIBPNG)5038 5034 static void gl2psPrintSVGPixmap(GLfloat x, GLfloat y, GL2PSimage *pixmap) 5039 #else5040 static void gl2psPrintSVGPixmap(GLfloat, GLfloat, GL2PSimage *)5041 #endif5042 5035 { 5043 5036 #if defined(GL2PS_HAVE_LIBPNG) … … 5066 5059 gl2psListDelete(png); 5067 5060 #else 5068 gl2psMsg(GL2PS_WARNING, "GL2PS has tobe compiled with PNG support in "5061 gl2psMsg(GL2PS_WARNING, "GL2PS must be compiled with PNG support in " 5069 5062 "order to embed images in SVG streams"); 5070 5063 #endif … … 5144 5137 gl2psPrintf("<text fill=\"%s\" x=\"%g\" y=\"%g\" font-size=\"%d\" ", 5145 5138 col, xyz[0][0], xyz[0][1], prim->data.text->fontsize); 5139 if(prim->data.text->angle) 5140 gl2psPrintf("transform=\"rotate(%g, %g, %g)\" ", 5141 -prim->data.text->angle, xyz[0][0], xyz[0][1]); 5146 5142 if(!strcmp(prim->data.text->fontname, "Times-Roman")) 5147 5143 gl2psPrintf("font-family=\"Times\">");
Note: See TracChangeset
for help on using the changeset viewer.