--- ray/src/util/findglare.c 2004/03/26 23:34:23 2.12 +++ ray/src/util/findglare.c 2022/11/29 20:45:21 2.16 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: findglare.c,v 2.12 2004/03/26 23:34:23 schorsch Exp $"; +static const char RCSid[] = "$Id: findglare.c,v 2.16 2022/11/29 20:45:21 greg Exp $"; #endif /* * Find glare sources in a scene or image. @@ -9,10 +9,6 @@ static const char RCSid[] = "$Id: findglare.c,v 2.12 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; @@ -65,7 +61,7 @@ main( while ((rval = expandarg(&argc, &argv, i)) > 0) ; if (rval < 0) { - fprintf(stderr, "%s: cannot expand '%s'", + fprintf(stderr, "%s: cannot expand '%s'\n", argv[0], argv[i]); exit(1); } @@ -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,7 +417,7 @@ 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) @@ -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++)