36 |
|
|
37 |
|
char *progname; /* global argv[0] */ |
38 |
|
|
39 |
< |
int verbose = 0; /* verbose mode? */ |
39 |
> |
int verbose = 0; /* verbose mode (< 0 no warnings) */ |
40 |
|
|
41 |
|
char *rcarg[MAXRCARG+1] = {"rcontrib", "-fo+"}; |
42 |
|
int nrcargs = 2; |
226 |
|
fputs(": command line too long in popen_arglist()\n", stderr); |
227 |
|
return(NULL); |
228 |
|
} |
229 |
< |
if (verbose) |
229 |
> |
if (verbose > 0) |
230 |
|
fprintf(stderr, "%s: opening pipe %s: %s\n", |
231 |
|
progname, (*mode=='w') ? "to" : "from", cmd); |
232 |
|
return(popen(cmd, mode)); |
244 |
|
fputs(": command line too long in my_exec()\n", stderr); |
245 |
|
return(1); |
246 |
|
} |
247 |
< |
if (verbose) |
247 |
> |
if (verbose > 0) |
248 |
|
fprintf(stderr, "%s: running: %s\n", progname, cmd); |
249 |
|
return(system(cmd)); |
250 |
|
} |
259 |
|
fprintf(stderr, "%s: cannot locate %s\n", progname, av[0]); |
260 |
|
return(1); |
261 |
|
} |
262 |
< |
if (verbose) { |
262 |
> |
if (verbose > 0) { |
263 |
|
char cmd[4096]; |
264 |
|
if (!convert_commandline(cmd, sizeof(cmd), av)) |
265 |
|
strcpy(cmd, "COMMAND TOO LONG TO SHOW"); |
516 |
|
{ |
517 |
|
int i; |
518 |
|
|
519 |
< |
uva[1][0] = 0.5 - frandom(); |
520 |
< |
uva[1][1] = 0.5 - frandom(); |
521 |
< |
uva[1][2] = 0.5 - frandom(); |
522 |
< |
for (i = 3; i--; ) |
523 |
< |
if ((-0.6 < nrm[i]) & (nrm[i] < 0.6)) |
524 |
< |
break; |
525 |
< |
if (i < 0) { |
519 |
> |
if (!getperpendicular(uva[0], nrm)) { |
520 |
|
fputs(progname, stderr); |
521 |
|
fputs(": bad surface normal in make_axes!\n", stderr); |
522 |
|
exit(1); |
523 |
|
} |
524 |
< |
uva[1][i] = 1.0; |
531 |
< |
VCROSS(uva[0], uva[1], nrm); |
532 |
< |
normalize(uva[0]); |
533 |
< |
VCROSS(uva[1], nrm, uva[0]); |
524 |
> |
fcross(uva[1], nrm, uva[0]); |
525 |
|
} |
526 |
|
|
527 |
|
/* Illegal sender surfaces end up here */ |
783 |
|
alt = (row+samp3[1])*RAH; |
784 |
|
azi = (2.*PI)*(col+samp3[2]-.5)/rnaz(row); |
785 |
|
duvw[2] = cos(alt); /* measured from horizon */ |
786 |
< |
duvw[0] = tcos(azi)*duvw[2]; |
787 |
< |
duvw[1] = tsin(azi)*duvw[2]; |
786 |
> |
duvw[0] = tsin(azi)*duvw[2]; |
787 |
> |
duvw[1] = tcos(azi)*duvw[2]; |
788 |
|
duvw[2] = sqrt(1. - duvw[2]*duvw[2]); |
789 |
|
for (i = 3; i--; ) |
790 |
|
orig_dir[1][i] = -duvw[0]*p->udir[i] - |
835 |
|
|
836 |
|
while (n--) { /* stratified sampling */ |
837 |
|
SDmultiSamp(samp2, 2, (n+frandom())/sampcnt); |
838 |
< |
if (!bo_getvec(duvw, b+samp2[1], kbasis[bi])) |
838 |
> |
if (!bi_getvec(duvw, b+samp2[1], kbasis[bi])) |
839 |
|
return(0); |
840 |
|
for (i = 3; i--; ) |
841 |
|
orig_dir[1][i] = duvw[0]*p->udir[i] + |
858 |
|
fputs(": no sender surface!\n", stderr); |
859 |
|
return(-1); |
860 |
|
} |
861 |
< |
if (curparams.outfn != NULL) /* misplaced output file spec. */ |
861 |
> |
/* misplaced output file spec. */ |
862 |
> |
if ((curparams.outfn != NULL) & (verbose >= 0)) |
863 |
|
fprintf(stderr, "%s: warning - ignoring output file in sender ('%s')\n", |
864 |
|
progname, curparams.outfn); |
865 |
|
/* check/set basis hemisphere */ |
1010 |
|
snew->area *= PI*snew->area; |
1011 |
|
break; |
1012 |
|
} |
1013 |
< |
if (snew->area <= FTINY) { |
1013 |
> |
if ((snew->area <= FTINY) & (verbose >= 0)) { |
1014 |
|
fprintf(stderr, "%s: warning - zero area for surface '%s'\n", |
1015 |
|
progname, oname); |
1016 |
|
free(snew); |
1197 |
|
na = 1; |
1198 |
|
switch (argv[a][1]) { /* !! Keep consistent !! */ |
1199 |
|
case 'v': /* verbose mode */ |
1200 |
< |
verbose = !verbose; |
1200 |
> |
verbose = 1; |
1201 |
|
na = 0; |
1202 |
|
continue; |
1203 |
|
case 'f': /* special case for -fo, -ff, etc. */ |
1238 |
|
iropt = argv[a]; |
1239 |
|
na = 0; |
1240 |
|
continue; |
1241 |
< |
case 'V': /* options without arguments */ |
1242 |
< |
case 'w': |
1241 |
> |
case 'w': /* options without arguments */ |
1242 |
> |
if (argv[a][2] != '+') verbose = -1; |
1243 |
> |
case 'V': |
1244 |
|
case 'u': |
1245 |
|
case 'h': |
1246 |
|
case 'r': |