--- ray/src/gen/mkillum.c 2007/09/14 21:29:08 2.29 +++ ray/src/gen/mkillum.c 2012/10/13 20:15:43 2.39 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: mkillum.c,v 2.29 2007/09/14 21:29:08 greg Exp $"; +static const char RCSid[] = "$Id: mkillum.c,v 2.39 2012/10/13 20:15:43 greg Exp $"; #endif /* * Make illum sources for optimizing rendering process @@ -8,9 +8,8 @@ static const char RCSid[] = "$Id: mkillum.c,v 2.29 200 #include #include -#include "platform.h" +#include "rtprocess.h" /* win_popen() */ #include "mkillum.h" -#include "random.h" /* default parameters */ #define SAMPDENS 48 /* points per projected steradian */ @@ -25,6 +24,7 @@ static const char RCSid[] = "$Id: mkillum.c,v 2.29 200 struct illum_args thisillum = { /* our illum and default values */ 0, + 0., DFLMAT, DFLDAT, 0, @@ -67,9 +67,8 @@ main( /* compute illum distributions using rtrace */ gargv = argv; progname = gargv[0]; /* set up rendering defaults */ - dstrsrc = 0.25; + dstrsrc = 0.5; directrelay = 3; - directvis = 0; ambounce = 2; /* get options from command line */ for (i = 1; i < argc; i++) { @@ -112,7 +111,7 @@ main( /* compute illum distributions using rtrace */ init(argv[gargc-1], nprocs); if (gargc < argc) { if (gargc == argc-1 || argv[gargc][0] != '<' || argv[gargc][1]) - error(USER, "Use '< file1 file2 ..' for multiple inputs"); + error(USER, "use '< file1 file2 ..' for multiple inputs"); for (i = gargc+1; i < argc; i++) { if ((fp = fopen(argv[i], "r")) == NULL) { sprintf(errmsg, @@ -175,6 +174,16 @@ char *s; void +quit(ec) /* make sure exit is called */ +int ec; +{ + if (ray_pnprocs > 0) /* close children if any */ + ray_pclose(0); + exit(ec); +} + + +void filter( /* process stream */ register FILE *infp, char *name @@ -216,6 +225,7 @@ xoptions( /* process options in string s */ { extern FILE *freopen(); char buf[64]; + int negax; int nerrs = 0; register char *cp; @@ -295,15 +305,20 @@ xoptions( /* process options in string s */ } cp = sskip(cp); continue; - case 'd': /* point sample density */ + case 'd': /* sample density */ if (*++cp != '=') break; - if (!isintd(++cp, " \t\n\r")) - break; - thisillum.sampdens = atoi(cp); + if (!*++cp || isspace(*cp)) + continue; + if (isintd(cp, " \t\n\r")) { + thisillum.sampdens = atoi(cp); + } else { + error(WARNING, "direct BSDF input unsupported"); + goto opterr; + } cp = sskip(cp); continue; - case 's': /* point super-samples */ + case 's': /* surface super-samples */ if (*++cp != '=') break; if (!isintd(++cp, " \t\n\r")) @@ -345,6 +360,16 @@ xoptions( /* process options in string s */ } doneheader = 0; continue; + case 't': /* object thickness */ + if (*++cp != '=') + break; + if (!isfltd(++cp, " \t\n\r")) + break; + thisillum.thick = atof(cp); + if (thisillum.thick < .0) + thisillum.thick = .0; + cp = sskip(cp); + continue; case '!': /* processed file! */ sprintf(errmsg, "(%s): already processed!", nm); error(WARNING, errmsg); @@ -387,9 +412,10 @@ printopts(void) /* print out option default values * printf("l+\t\t\t\t# light type on\n"); else printf("l-\t\t\t\t# light type off\n"); - printf("d=%d\t\t\t\t# density of points\n", thisillum.sampdens); - printf("s=%d\t\t\t\t# samples per point\n", thisillum.nsamps); + printf("d=%d\t\t\t\t# density of directions\n", thisillum.sampdens); + printf("s=%d\t\t\t\t# samples per direction\n", thisillum.nsamps); printf("b=%f\t\t\t# minimum average brightness\n", thisillum.minbrt); + printf("t=%f\t\t\t# object thickness\n", thisillum.thick); }