--- ray/src/util/findglare.c 2009/02/07 05:40:47 2.13 +++ ray/src/util/findglare.c 2023/01/15 16:38:10 2.17 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: findglare.c,v 2.13 2009/02/07 05:40:47 greg Exp $"; +static const char RCSid[] = "$Id: findglare.c,v 2.17 2023/01/15 16:38:10 greg Exp $"; #endif /* * Find glare sources in a scene or image. @@ -9,10 +9,6 @@ static const char RCSid[] = "$Id: findglare.c,v 2.13 2 #include "glare.h" -#define FEQ(a,b) ((a)-(b)<=FTINY&&(b)-(a)<=FTINY) -#define VEQ(v1,v2) (FEQ((v1)[0],(v2)[0])&&FEQ((v1)[1],(v2)[1]) \ - &&FEQ((v1)[2],(v2)[2])) - char *rtargv[64] = {"rtrace", "-h-", "-ov", "-fff", "-ld-", "-i-", "-I-"}; int rtargc = 7; @@ -129,10 +125,13 @@ main( /* FALL THROUGH */ case 's': case 'P': + case 'n': rtargv[rtargc++] = argv[i]; rtargv[rtargc++] = argv[++i]; break; case 'w': + case 'u': + case 'b': rtargv[rtargc++] = argv[i]; break; case 'a': @@ -143,6 +142,14 @@ main( } rtargv[rtargc++] = argv[++i]; break; + case 'm': + rtargv[rtargc++] = argv[i]; + if ((argv[i][2] == 'e') | (argv[i][2] == 'a')) { + rtargv[rtargc++] = argv[++i]; + rtargv[rtargc++] = argv[++i]; + } + rtargv[rtargc++] = argv[++i]; + break; default: goto userr; } @@ -184,7 +191,7 @@ main( exit(1); } ourview = pictview; - } else if (picture != NULL && !VEQ(ourview.vp, pictview.vp)) { + } else if (picture != NULL && !VABSEQ(ourview.vp, pictview.vp)) { fprintf(stderr, "%s: picture must have same viewpoint\n", progname); exit(1); @@ -236,7 +243,7 @@ angcmp( /* compare two angles */ const void *ap2 ) { - register int a1, a2; + int a1, a2; a1 = *(ANGLE *)ap1; a2 = *(ANGLE *)ap2; @@ -253,7 +260,7 @@ static void init(void) /* initialize global variables */ { double d; - register int i; + int i; if (verbose) fprintf(stderr, "%s: initializing data structures...\n", @@ -341,7 +348,7 @@ cleanup(void) /* close files, wait for children */ } -extern int +int compdir( /* compute direction for x,y */ FVECT vd, int x, @@ -374,13 +381,13 @@ compdir( /* compute direction for x,y */ } -extern double +double pixsize( /* return the solid angle of pixel at (x,y) */ int x, int y ) { - register int hl, xo; + int hl, xo; double disc; hl = hlim(y); @@ -397,7 +404,7 @@ pixsize( /* return the solid angle of pixel at (x,y) } -extern void +void memerr( /* malloc failure */ char *s ) @@ -410,11 +417,11 @@ memerr( /* malloc failure */ static void printsources(void) /* print out glare sources */ { - register struct source *sp; + struct source *sp; printf("BEGIN glare source\n"); for (sp = donelist; sp != NULL; sp = sp->next) - printf("\t%f %f %f\t%f\t%f\n", + printf("\t%f %f %f\t%e\t%e\n", sp->dir[0], sp->dir[1], sp->dir[2], sp->dom, sp->brt); printf("END glare source\n"); @@ -424,7 +431,7 @@ printsources(void) /* print out glare sources */ static void printillum(void) /* print out indirect illuminances */ { - register int i; + int i; printf("BEGIN indirect illuminance\n"); for (i = 0; i < nglardirs; i++)