8 |
|
#include <signal.h> |
9 |
|
#include <ctype.h> |
10 |
|
|
11 |
< |
#include "platform.h" |
11 |
> |
#include "rtprocess.h" /* win_popen() */ |
12 |
|
#include "mkillum.h" |
13 |
– |
#include "random.h" |
13 |
|
|
14 |
|
/* default parameters */ |
15 |
|
#define SAMPDENS 48 /* points per projected steradian */ |
24 |
|
|
25 |
|
struct illum_args thisillum = { /* our illum and default values */ |
26 |
|
0, |
27 |
+ |
0., |
28 |
|
DFLMAT, |
29 |
|
DFLDAT, |
30 |
|
0, |
67 |
|
gargv = argv; |
68 |
|
progname = gargv[0]; |
69 |
|
/* set up rendering defaults */ |
70 |
< |
dstrsrc = 0.25; |
70 |
> |
dstrsrc = 0.5; |
71 |
|
directrelay = 3; |
72 |
– |
directvis = 0; |
72 |
|
ambounce = 2; |
73 |
|
/* get options from command line */ |
74 |
|
for (i = 1; i < argc; i++) { |
111 |
|
init(argv[gargc-1], nprocs); |
112 |
|
if (gargc < argc) { |
113 |
|
if (gargc == argc-1 || argv[gargc][0] != '<' || argv[gargc][1]) |
114 |
< |
error(USER, "Use '< file1 file2 ..' for multiple inputs"); |
114 |
> |
error(USER, "use '< file1 file2 ..' for multiple inputs"); |
115 |
|
for (i = gargc+1; i < argc; i++) { |
116 |
|
if ((fp = fopen(argv[i], "r")) == NULL) { |
117 |
|
sprintf(errmsg, |
174 |
|
|
175 |
|
|
176 |
|
void |
177 |
+ |
quit(ec) /* make sure exit is called */ |
178 |
+ |
int ec; |
179 |
+ |
{ |
180 |
+ |
if (ray_pnprocs > 0) /* close children if any */ |
181 |
+ |
ray_pclose(0); |
182 |
+ |
exit(ec); |
183 |
+ |
} |
184 |
+ |
|
185 |
+ |
|
186 |
+ |
void |
187 |
|
filter( /* process stream */ |
188 |
|
register FILE *infp, |
189 |
|
char *name |
225 |
|
{ |
226 |
|
extern FILE *freopen(); |
227 |
|
char buf[64]; |
228 |
+ |
int negax; |
229 |
|
int nerrs = 0; |
230 |
|
register char *cp; |
231 |
|
|
305 |
|
} |
306 |
|
cp = sskip(cp); |
307 |
|
continue; |
308 |
< |
case 'd': /* point sample density */ |
308 |
> |
case 'd': /* sample density */ |
309 |
|
if (*++cp != '=') |
310 |
|
break; |
311 |
< |
if (!isintd(++cp, " \t\n\r")) |
312 |
< |
break; |
313 |
< |
thisillum.sampdens = atoi(cp); |
311 |
> |
if (!*++cp || isspace(*cp)) |
312 |
> |
continue; |
313 |
> |
if (isintd(cp, " \t\n\r")) { |
314 |
> |
thisillum.sampdens = atoi(cp); |
315 |
> |
} else { |
316 |
> |
error(WARNING, "direct BSDF input unsupported"); |
317 |
> |
goto opterr; |
318 |
> |
} |
319 |
|
cp = sskip(cp); |
320 |
|
continue; |
321 |
< |
case 's': /* point super-samples */ |
321 |
> |
case 's': /* surface super-samples */ |
322 |
|
if (*++cp != '=') |
323 |
|
break; |
324 |
|
if (!isintd(++cp, " \t\n\r")) |
360 |
|
} |
361 |
|
doneheader = 0; |
362 |
|
continue; |
363 |
+ |
case 't': /* object thickness */ |
364 |
+ |
if (*++cp != '=') |
365 |
+ |
break; |
366 |
+ |
if (!isfltd(++cp, " \t\n\r")) |
367 |
+ |
break; |
368 |
+ |
thisillum.thick = atof(cp); |
369 |
+ |
if (thisillum.thick < .0) |
370 |
+ |
thisillum.thick = .0; |
371 |
+ |
cp = sskip(cp); |
372 |
+ |
continue; |
373 |
|
case '!': /* processed file! */ |
374 |
|
sprintf(errmsg, "(%s): already processed!", nm); |
375 |
|
error(WARNING, errmsg); |
412 |
|
printf("l+\t\t\t\t# light type on\n"); |
413 |
|
else |
414 |
|
printf("l-\t\t\t\t# light type off\n"); |
415 |
< |
printf("d=%d\t\t\t\t# density of points\n", thisillum.sampdens); |
416 |
< |
printf("s=%d\t\t\t\t# samples per point\n", thisillum.nsamps); |
415 |
> |
printf("d=%d\t\t\t\t# density of directions\n", thisillum.sampdens); |
416 |
> |
printf("s=%d\t\t\t\t# samples per direction\n", thisillum.nsamps); |
417 |
|
printf("b=%f\t\t\t# minimum average brightness\n", thisillum.minbrt); |
418 |
+ |
printf("t=%f\t\t\t# object thickness\n", thisillum.thick); |
419 |
|
} |
420 |
|
|
421 |
|
|