11 |
|
#include <stdlib.h> |
12 |
|
#include "rtio.h" |
13 |
|
#include "rtmath.h" |
14 |
+ |
#include "paths.h" |
15 |
|
#include "bsdf.h" |
16 |
|
#include "bsdf_m.h" |
17 |
|
#include "random.h" |
18 |
|
#include "triangulate.h" |
19 |
|
#include "platform.h" |
20 |
|
|
20 |
– |
#ifdef getc_unlocked /* avoid horrendous overhead of flockfile */ |
21 |
– |
#undef getc |
22 |
– |
#define getc getc_unlocked |
23 |
– |
#endif |
24 |
– |
|
25 |
– |
#ifdef _WIN32 |
26 |
– |
#define SPECIALS " \t\"$*?" |
27 |
– |
#define QUOTCHAR '"' |
28 |
– |
#else |
29 |
– |
#define SPECIALS " \t\n'\"()${}*?[];|&" |
30 |
– |
#define QUOTCHAR '\'' |
31 |
– |
#define ALTQUOT '"' |
32 |
– |
#endif |
33 |
– |
|
21 |
|
#define MAXRCARG 512 |
22 |
|
|
23 |
|
char *progname; /* global argv[0] */ |
24 |
|
|
25 |
< |
int verbose = 0; /* verbose mode? */ |
25 |
> |
int verbose = 0; /* verbose mode (< 0 no warnings) */ |
26 |
|
|
27 |
|
char *rcarg[MAXRCARG+1] = {"rcontrib", "-fo+"}; |
28 |
|
int nrcargs = 2; |
70 |
|
} POLYTRIS; /* triangulated polygon */ |
71 |
|
|
72 |
|
typedef struct param_s { |
73 |
< |
char hemis[32]; /* hemispherical sampling spec. */ |
73 |
> |
char sign; /* '-' for axis reversal */ |
74 |
> |
char hemis[31]; /* hemispherical sampling spec. */ |
75 |
|
int hsiz; /* hemisphere basis size */ |
76 |
|
int nsurfs; /* number of surfaces */ |
77 |
|
SURF *slist; /* list of surfaces */ |
78 |
|
FVECT vup; /* up vector (zero if unset) */ |
79 |
|
FVECT nrm; /* average normal direction */ |
80 |
< |
FVECT udir, vdir; /* v-up tangent axes */ |
80 |
> |
FVECT udir, vdir; /* tangent axes */ |
81 |
|
char *outfn; /* output file name (receiver) */ |
82 |
|
int (*sample_basis)(struct param_s *p, int, FILE *); |
83 |
|
} PARAMS; /* sender/receiver parameters */ |
132 |
|
static char * |
133 |
|
oconv_command(int ac, char *av[]) |
134 |
|
{ |
135 |
< |
static char oconvbuf[2048] = "!oconv -f"; |
136 |
< |
char *cp = oconvbuf + 9; |
137 |
< |
|
135 |
> |
static char oconvbuf[2048] = "!oconv -f "; |
136 |
> |
char *cp = oconvbuf + 10; |
137 |
> |
char *recv = *av++; |
138 |
> |
|
139 |
> |
if (ac-- <= 0) |
140 |
> |
return(NULL); |
141 |
|
while (ac-- > 0) { |
151 |
– |
if (cp >= oconvbuf+(sizeof(oconvbuf)-32)) { |
152 |
– |
fputs(progname, stderr); |
153 |
– |
fputs(": too many file arguments!\n", stderr); |
154 |
– |
exit(1); |
155 |
– |
} |
156 |
– |
*cp++ = ' '; |
142 |
|
strcpy(cp, *av++); |
143 |
|
while (*cp) cp++; |
144 |
+ |
*cp++ = ' '; |
145 |
+ |
if (cp >= oconvbuf+(sizeof(oconvbuf)-32)) |
146 |
+ |
goto overrun; |
147 |
|
} |
148 |
< |
*cp = '\0'; |
148 |
> |
/* receiver goes last */ |
149 |
> |
if (matchany(recv, SPECIALS)) { |
150 |
> |
*cp++ = QUOTCHAR; |
151 |
> |
while (*recv) { |
152 |
> |
if (cp >= oconvbuf+(sizeof(oconvbuf)-3)) |
153 |
> |
goto overrun; |
154 |
> |
*cp++ = *recv++; |
155 |
> |
} |
156 |
> |
*cp++ = QUOTCHAR; |
157 |
> |
*cp = '\0'; |
158 |
> |
} else |
159 |
> |
strcpy(cp, recv); |
160 |
|
return(oconvbuf); |
161 |
+ |
overrun: |
162 |
+ |
fputs(progname, stderr); |
163 |
+ |
fputs(": too many file arguments!\n", stderr); |
164 |
+ |
exit(1); |
165 |
|
} |
166 |
|
|
164 |
– |
/* Check if any of the characters in str2 are found in str1 */ |
165 |
– |
static int |
166 |
– |
matchany(const char *str1, const char *str2) |
167 |
– |
{ |
168 |
– |
while (*str1) { |
169 |
– |
const char *cp = str2; |
170 |
– |
while (*cp) |
171 |
– |
if (*cp++ == *str1) |
172 |
– |
return(*str1); |
173 |
– |
++str1; |
174 |
– |
} |
175 |
– |
return(0); |
176 |
– |
} |
177 |
– |
|
178 |
– |
|
179 |
– |
/* Convert a set of arguments into a command line for pipe() or system() */ |
180 |
– |
static char * |
181 |
– |
convert_commandline(char *cmd, const int len, char *av[]) |
182 |
– |
{ |
183 |
– |
int match; |
184 |
– |
char *cp; |
185 |
– |
|
186 |
– |
for (cp = cmd; *av != NULL; av++) { |
187 |
– |
const int n = strlen(*av); |
188 |
– |
if (cp+n >= cmd+(len-3)) { |
189 |
– |
fputs(progname, stderr); |
190 |
– |
return(NULL); |
191 |
– |
} |
192 |
– |
if ((match = matchany(*av, SPECIALS))) { |
193 |
– |
const int quote = |
194 |
– |
#ifdef ALTQUOT |
195 |
– |
(match == QUOTCHAR) ? ALTQUOT : |
196 |
– |
#endif |
197 |
– |
QUOTCHAR; |
198 |
– |
*cp++ = quote; |
199 |
– |
strcpy(cp, *av); |
200 |
– |
cp += n; |
201 |
– |
*cp++ = quote; |
202 |
– |
} else { |
203 |
– |
strcpy(cp, *av); |
204 |
– |
cp += n; |
205 |
– |
} |
206 |
– |
*cp++ = ' '; |
207 |
– |
} |
208 |
– |
if (cp <= cmd) |
209 |
– |
return(NULL); |
210 |
– |
*--cp = '\0'; |
211 |
– |
return(cmd); |
212 |
– |
} |
213 |
– |
|
167 |
|
/* Open a pipe to/from a command given as an argument list */ |
168 |
|
static FILE * |
169 |
|
popen_arglist(char *av[], char *mode) |
175 |
|
fputs(": command line too long in popen_arglist()\n", stderr); |
176 |
|
return(NULL); |
177 |
|
} |
178 |
< |
if (verbose) |
178 |
> |
if (verbose > 0) |
179 |
|
fprintf(stderr, "%s: opening pipe %s: %s\n", |
180 |
|
progname, (*mode=='w') ? "to" : "from", cmd); |
181 |
|
return(popen(cmd, mode)); |
182 |
|
} |
183 |
|
|
184 |
< |
#ifdef _WIN32 |
184 |
> |
#if defined(_WIN32) || defined(_WIN64) |
185 |
|
/* Execute system command (Windows version) */ |
186 |
|
static int |
187 |
|
my_exec(char *av[]) |
193 |
|
fputs(": command line too long in my_exec()\n", stderr); |
194 |
|
return(1); |
195 |
|
} |
196 |
< |
if (verbose) |
196 |
> |
if (verbose > 0) |
197 |
|
fprintf(stderr, "%s: running: %s\n", progname, cmd); |
198 |
|
return(system(cmd)); |
199 |
|
} |
208 |
|
fprintf(stderr, "%s: cannot locate %s\n", progname, av[0]); |
209 |
|
return(1); |
210 |
|
} |
211 |
< |
if (verbose) { |
211 |
> |
if (verbose > 0) { |
212 |
|
char cmd[4096]; |
213 |
|
if (!convert_commandline(cmd, sizeof(cmd), av)) |
214 |
|
strcpy(cmd, "COMMAND TOO LONG TO SHOW"); |
266 |
|
{ |
267 |
|
char *cp = pargs; |
268 |
|
int nparams = 0; |
269 |
+ |
int quot; |
270 |
|
int i; |
271 |
|
|
272 |
< |
for ( ; ; ) |
272 |
> |
for ( ; ; ) { |
273 |
|
switch (*cp++) { |
274 |
|
case 'h': |
275 |
|
if (*cp++ != '=') |
276 |
|
break; |
277 |
+ |
if ((*cp == '+') | (*cp == '-')) |
278 |
+ |
p->sign = *cp++; |
279 |
+ |
else |
280 |
+ |
p->sign = '+'; |
281 |
|
p->hsiz = 0; |
282 |
|
i = 0; |
283 |
|
while (*cp && !isspace(*cp)) { |
296 |
|
break; |
297 |
|
if (!get_direction(p->vup, cp)) |
298 |
|
break; |
299 |
+ |
while (*cp && !isspace(*cp++)) |
300 |
+ |
; |
301 |
|
++nparams; |
302 |
|
continue; |
303 |
|
case 'o': |
304 |
|
if (*cp++ != '=') |
305 |
|
break; |
306 |
+ |
quot = 0; |
307 |
+ |
if ((*cp == '"') | (*cp == '\'')) |
308 |
+ |
quot = *cp++; |
309 |
|
i = 0; |
310 |
< |
while (*cp && !isspace(*cp++)) |
311 |
< |
i++; |
310 |
> |
while (*cp && (quot ? (*cp != quot) : !isspace(*cp))) { |
311 |
> |
i++; cp++; |
312 |
> |
} |
313 |
|
if (!i) |
314 |
|
break; |
315 |
< |
*--cp = '\0'; |
315 |
> |
if (!*cp) { |
316 |
> |
if (quot) |
317 |
> |
break; |
318 |
> |
cp[1] = '\0'; |
319 |
> |
} |
320 |
> |
*cp = '\0'; |
321 |
|
p->outfn = savqstr(cp-i); |
322 |
< |
*cp++ = ' '; |
322 |
> |
*cp++ = quot ? quot : ' '; |
323 |
|
++nparams; |
324 |
|
continue; |
325 |
|
case ' ': |
332 |
|
default: |
333 |
|
break; |
334 |
|
} |
335 |
< |
fprintf(stderr, "%s: bad parameter string '%s'\n", progname, pargs); |
335 |
> |
break; |
336 |
> |
} |
337 |
> |
fprintf(stderr, "%s: bad parameter string: %s", progname, pargs); |
338 |
|
exit(1); |
339 |
|
return(-1); /* pro forma return */ |
340 |
|
} |
380 |
|
} |
381 |
|
/* determine sample type/bin */ |
382 |
|
if (tolower(curparams.hemis[0]) == 'u' | curparams.hemis[0] == '1') { |
383 |
< |
binv = "0"; /* uniform sampling -- one bin */ |
383 |
> |
sprintf(sbuf, "if(-Dx*%g-Dy*%g-Dz*%g,0,-1)", |
384 |
> |
curparams.nrm[0], curparams.nrm[1], curparams.nrm[2]); |
385 |
> |
binv = savqstr(sbuf); |
386 |
> |
nbins = "1"; /* uniform sampling -- one bin */ |
387 |
|
uniform = 1; |
388 |
|
} else if (tolower(curparams.hemis[0]) == 's' && |
389 |
|
tolower(curparams.hemis[1]) == 'c') { |
394 |
|
exit(1); |
395 |
|
} |
396 |
|
calfn = shirchiufn; shirchiufn = NULL; |
397 |
< |
sprintf(sbuf, "SCdim=%d,rNx=%g,rNy=%g,rNz=%g,Ux=%g,Uy=%g,Uz=%g", |
397 |
> |
sprintf(sbuf, "SCdim=%d,rNx=%g,rNy=%g,rNz=%g,Ux=%g,Uy=%g,Uz=%g,RHS=%c1", |
398 |
|
curparams.hsiz, |
399 |
|
curparams.nrm[0], curparams.nrm[1], curparams.nrm[2], |
400 |
< |
curparams.vup[0], curparams.vup[1], curparams.vup[2]); |
400 |
> |
curparams.vup[0], curparams.vup[1], curparams.vup[2], |
401 |
> |
curparams.sign); |
402 |
|
params = savqstr(sbuf); |
403 |
|
binv = "scbin"; |
404 |
|
nbins = "SCdim*SCdim"; |
405 |
|
} else if ((tolower(curparams.hemis[0]) == 'r') | |
406 |
|
(tolower(curparams.hemis[0]) == 't')) { |
407 |
|
calfn = reinhfn; reinhfn = NULL; |
408 |
< |
sprintf(sbuf, "MF=%d,rNx=%g,rNy=%g,rNz=%g,Ux=%g,Uy=%g,Uz=%g", |
408 |
> |
sprintf(sbuf, "MF=%d,rNx=%g,rNy=%g,rNz=%g,Ux=%g,Uy=%g,Uz=%g,RHS=%c1", |
409 |
|
curparams.hsiz, |
410 |
|
curparams.nrm[0], curparams.nrm[1], curparams.nrm[2], |
411 |
< |
curparams.vup[0], curparams.vup[1], curparams.vup[2]); |
411 |
> |
curparams.vup[0], curparams.vup[1], curparams.vup[2], |
412 |
> |
curparams.sign); |
413 |
|
params = savqstr(sbuf); |
414 |
|
binv = "rbin"; |
415 |
|
nbins = "Nrbins"; |
437 |
|
progname, curparams.hemis); |
438 |
|
exit(1); |
439 |
|
} |
440 |
+ |
if (tolower(curparams.hemis[0]) == 'k') { |
441 |
+ |
sprintf(sbuf, "RHS=%c1", curparams.sign); |
442 |
+ |
params = savqstr(sbuf); |
443 |
+ |
} |
444 |
|
if (!uniform & (curparams.slist->styp == ST_SOURCE)) { |
445 |
|
SURF *sp; |
446 |
|
for (sp = curparams.slist; sp != NULL; sp = sp->next) |
488 |
|
{ |
489 |
|
int i; |
490 |
|
|
491 |
< |
uva[1][0] = 0.5 - frandom(); |
512 |
< |
uva[1][1] = 0.5 - frandom(); |
513 |
< |
uva[1][2] = 0.5 - frandom(); |
514 |
< |
for (i = 3; i--; ) |
515 |
< |
if ((-0.6 < nrm[i]) & (nrm[i] < 0.6)) |
516 |
< |
break; |
517 |
< |
if (i < 0) { |
491 |
> |
if (!getperpendicular(uva[0], nrm, 1)) { |
492 |
|
fputs(progname, stderr); |
493 |
|
fputs(": bad surface normal in make_axes!\n", stderr); |
494 |
|
exit(1); |
495 |
|
} |
496 |
< |
uva[1][i] = 1.0; |
523 |
< |
VCROSS(uva[0], uva[1], nrm); |
524 |
< |
normalize(uva[0]); |
525 |
< |
VCROSS(uva[1], nrm, uva[0]); |
496 |
> |
fcross(uva[1], nrm, uva[0]); |
497 |
|
} |
498 |
|
|
499 |
|
/* Illegal sender surfaces end up here */ |
632 |
|
/* special case for lone surface */ |
633 |
|
if (p->nsurfs == 1) { |
634 |
|
sp = p->slist; |
635 |
< |
if (DOT(sp->snrm, rdir) >= -FTINY) { |
635 |
> |
if (DOT(sp->snrm, rdir) >= FTINY) { |
636 |
|
fprintf(stderr, |
637 |
|
"%s: internal - sample behind sender '%s'\n", |
638 |
|
progname, sp->sname); |
755 |
|
alt = (row+samp3[1])*RAH; |
756 |
|
azi = (2.*PI)*(col+samp3[2]-.5)/rnaz(row); |
757 |
|
duvw[2] = cos(alt); /* measured from horizon */ |
758 |
< |
duvw[0] = tcos(azi)*duvw[2]; |
759 |
< |
duvw[1] = tsin(azi)*duvw[2]; |
758 |
> |
duvw[0] = tsin(azi)*duvw[2]; |
759 |
> |
duvw[1] = tcos(azi)*duvw[2]; |
760 |
|
duvw[2] = sqrt(1. - duvw[2]*duvw[2]); |
761 |
|
for (i = 3; i--; ) |
762 |
|
orig_dir[1][i] = -duvw[0]*p->udir[i] - |
807 |
|
|
808 |
|
while (n--) { /* stratified sampling */ |
809 |
|
SDmultiSamp(samp2, 2, (n+frandom())/sampcnt); |
810 |
< |
if (!bo_getvec(duvw, b+samp2[1], kbasis[bi])) |
810 |
> |
if (!fo_getvec(duvw, b+samp2[1], kbasis[bi])) |
811 |
|
return(0); |
812 |
|
for (i = 3; i--; ) |
813 |
< |
orig_dir[1][i] = duvw[0]*p->udir[i] + |
814 |
< |
duvw[1]*p->vdir[i] + |
813 |
> |
orig_dir[1][i] = -duvw[0]*p->udir[i] - |
814 |
> |
duvw[1]*p->vdir[i] - |
815 |
|
duvw[2]*p->nrm[i] ; |
816 |
|
if (!sample_origin(p, orig_dir[0], orig_dir[1], samp2[0])) |
817 |
|
return(0); |
830 |
|
fputs(": no sender surface!\n", stderr); |
831 |
|
return(-1); |
832 |
|
} |
833 |
< |
if (curparams.outfn != NULL) /* misplaced output file spec. */ |
833 |
> |
/* misplaced output file spec. */ |
834 |
> |
if ((curparams.outfn != NULL) & (verbose >= 0)) |
835 |
|
fprintf(stderr, "%s: warning - ignoring output file in sender ('%s')\n", |
836 |
|
progname, curparams.outfn); |
837 |
|
/* check/set basis hemisphere */ |
851 |
|
else |
852 |
|
curparams.vup[1] = 1; |
853 |
|
} |
854 |
< |
VCROSS(curparams.udir, curparams.vup, curparams.nrm); |
854 |
> |
fcross(curparams.udir, curparams.vup, curparams.nrm); |
855 |
|
if (normalize(curparams.udir) == 0) { |
856 |
|
fputs(progname, stderr); |
857 |
|
fputs(": up vector coincides with sender normal\n", stderr); |
858 |
|
return(-1); |
859 |
|
} |
860 |
< |
VCROSS(curparams.vdir, curparams.nrm, curparams.udir); |
860 |
> |
fcross(curparams.vdir, curparams.nrm, curparams.udir); |
861 |
> |
if (curparams.sign == '-') { /* left-handed coordinate system? */ |
862 |
> |
curparams.udir[0] *= -1.; |
863 |
> |
curparams.udir[1] *= -1.; |
864 |
> |
curparams.udir[2] *= -1.; |
865 |
> |
} |
866 |
|
if (tolower(curparams.hemis[0]) == 'u' | curparams.hemis[0] == '1') |
867 |
|
curparams.sample_basis = sample_uniform; |
868 |
|
else if (tolower(curparams.hemis[0]) == 's' && |
987 |
|
snew->area *= PI*snew->area; |
988 |
|
break; |
989 |
|
} |
990 |
< |
if (snew->area <= FTINY) { |
990 |
> |
if ((snew->area <= FTINY) & (verbose >= 0)) { |
991 |
|
fprintf(stderr, "%s: warning - zero area for surface '%s'\n", |
992 |
|
progname, oname); |
993 |
|
free(snew); |
1057 |
|
add_send_object(FILE *fp) |
1058 |
|
{ |
1059 |
|
int st; |
1060 |
< |
char otype[32], oname[128]; |
1060 |
> |
char thismod[128], otype[32], oname[128]; |
1061 |
|
int n; |
1062 |
|
|
1063 |
< |
if (fscanf(fp, "%*s %s %s", otype, oname) != 2) |
1063 |
> |
if (fscanf(fp, "%s %s %s", thismod, otype, oname) != 3) |
1064 |
|
return(0); /* must have hit EOF! */ |
1065 |
|
if (!strcmp(otype, "alias")) { |
1066 |
|
fscanf(fp, "%*s"); /* skip alias */ |
1073 |
|
fputs(": cannot use source as a sender!\n", stderr); |
1074 |
|
return(-1); |
1075 |
|
} |
1076 |
+ |
if (strcmp(thismod, curmod)) { |
1077 |
+ |
if (curmod[0]) { |
1078 |
+ |
fputs(progname, stderr); |
1079 |
+ |
fputs(": warning - multiple modifiers in sender\n", |
1080 |
+ |
stderr); |
1081 |
+ |
} |
1082 |
+ |
strcpy(curmod, thismod); |
1083 |
+ |
} |
1084 |
|
parse_params(&curparams, newparams); |
1085 |
|
newparams[0] = '\0'; |
1086 |
|
add_surface(st, oname, fp); /* read & store surface */ |
1167 |
|
int a, i; |
1168 |
|
/* screen rcontrib options */ |
1169 |
|
progname = argv[0]; |
1170 |
< |
for (a = 1; a < argc-2 && argv[a][0] == '-'; a++) { |
1171 |
< |
int na = 1; /* !! Keep consistent !! */ |
1172 |
< |
switch (argv[a][1]) { |
1170 |
> |
for (a = 1; a < argc-2; a++) { |
1171 |
> |
int na; |
1172 |
> |
/* check for argument expansion */ |
1173 |
> |
while ((na = expandarg(&argc, &argv, a)) > 0) |
1174 |
> |
; |
1175 |
> |
if (na < 0) { |
1176 |
> |
fprintf(stderr, "%s: cannot expand '%s'\n", |
1177 |
> |
progname, argv[a]); |
1178 |
> |
return(1); |
1179 |
> |
} |
1180 |
> |
if (argv[a][0] != '-' || !argv[a][1]) |
1181 |
> |
break; |
1182 |
> |
na = 1; |
1183 |
> |
switch (argv[a][1]) { /* !! Keep consistent !! */ |
1184 |
|
case 'v': /* verbose mode */ |
1185 |
< |
verbose = !verbose; |
1185 |
> |
verbose = 1; |
1186 |
|
na = 0; |
1187 |
|
continue; |
1188 |
|
case 'f': /* special case for -fo, -ff, etc. */ |
1223 |
|
iropt = argv[a]; |
1224 |
|
na = 0; |
1225 |
|
continue; |
1226 |
< |
case 'V': /* options without arguments */ |
1227 |
< |
case 'w': |
1226 |
> |
case 'w': /* options without arguments */ |
1227 |
> |
if (argv[a][2] != '+') verbose = -1; |
1228 |
> |
case 'V': |
1229 |
|
case 'u': |
1230 |
|
case 'h': |
1231 |
|
case 'r': |
1250 |
|
if (argv[a][2] != 'v') na = 2; |
1251 |
|
break; |
1252 |
|
case 'a': /* special case */ |
1253 |
< |
na = (argv[a][2] == 'v') ? 4 : 2; |
1253 |
> |
if (argv[a][2] == 'p') { |
1254 |
> |
na = 2; /* photon map [+ bandwidth(s)] */ |
1255 |
> |
if (a < argc-3 && atoi(argv[a+1]) > 0) |
1256 |
> |
na += 1 + (a < argc-4 && atoi(argv[a+2]) > 0); |
1257 |
> |
} else |
1258 |
> |
na = (argv[a][2] == 'v') ? 4 : 2; |
1259 |
|
break; |
1260 |
|
case 'm': /* special case */ |
1261 |
|
if (!argv[a][2]) goto userr; |
1262 |
|
na = (argv[a][2] == 'e') | (argv[a][2] == 'a') ? 4 : 2; |
1263 |
|
break; |
1262 |
– |
case '\0': /* pass-through mode */ |
1263 |
– |
goto done_opts; |
1264 |
|
default: /* anything else is verbotten */ |
1265 |
|
goto userr; |
1266 |
|
} |
1270 |
|
while (--na) /* + arguments if any */ |
1271 |
|
rcarg[nrcargs++] = argv[++a]; |
1272 |
|
} |
1273 |
– |
done_opts: |
1273 |
|
if (a > argc-2) |
1274 |
|
goto userr; /* check at end of options */ |
1275 |
|
sendfn = argv[a++]; /* assign sender & receiver inputs */ |
1320 |
|
return(my_exec(rcarg)); /* rcontrib does everything */ |
1321 |
|
} |
1322 |
|
clear_params(&curparams, 0); /* else load sender surface & params */ |
1323 |
+ |
curmod[0] = '\0'; |
1324 |
|
if (load_scene(sendfn, add_send_object) < 0) |
1325 |
|
return(1); |
1326 |
|
if ((nsbins = prepare_sampler()) <= 0) |
1338 |
|
#ifdef getc_unlocked |
1339 |
|
flockfile(rcfp); |
1340 |
|
#endif |
1341 |
< |
if (verbose) { |
1341 |
> |
if (verbose > 0) { |
1342 |
|
fprintf(stderr, "%s: sampling %d directions", progname, nsbins); |
1343 |
|
if (curparams.nsurfs > 1) |
1344 |
|
fprintf(stderr, " (%d elements)\n", curparams.nsurfs); |
1348 |
|
for (i = 0; i < nsbins; i++) /* send rcontrib ray samples */ |
1349 |
|
if (!(*curparams.sample_basis)(&curparams, i, rcfp)) |
1350 |
|
return(1); |
1351 |
< |
return(pclose(rcfp) == 0); /* all finished! */ |
1351 |
> |
return(pclose(rcfp) < 0); /* all finished! */ |
1352 |
|
userr: |
1353 |
|
if (a < argc-2) |
1354 |
|
fprintf(stderr, "%s: unsupported option '%s'", progname, argv[a]); |
1355 |
< |
fprintf(stderr, "Usage: %s [-v][rcontrib options] sender.rad receiver.rad [system.rad ..]\n", |
1355 |
> |
fprintf(stderr, "Usage: %s [-v][rcontrib options] sender.rad receiver.rad [-i system.oct] [system.rad ..]\n", |
1356 |
|
progname); |
1357 |
|
return(1); |
1358 |
|
} |