--- ray/src/gen/mkillum.c 1991/08/13 14:43:49 1.11 +++ ray/src/gen/mkillum.c 1995/11/14 16:03:46 2.9 @@ -1,4 +1,4 @@ -/* Copyright (c) 1991 Regents of the University of California */ +/* Copyright (c) 1995 Regents of the University of California */ #ifndef lint static char SCCSid[] = "$SunId$ LBL"; @@ -26,11 +26,11 @@ static char SCCSid[] = "$SunId$ LBL"; #define S_ALL 3 /* select all */ /* rtrace command and defaults */ -char *rtargv[64] = { "rtrace", "-dj", ".25", "-dr", "3", "-di+", +char *rtargv[64] = { "rtrace", "-dj", ".25", "-dr", "3", "-dv-", "-ab", "2", "-ad", "256", "-as", "128", "-aa", ".15", }; int rtargc = 14; /* overriding rtrace options */ -char *myrtopts[] = { "-I-", "-i-", "-ov", "-h-", "-fff", NULL }; +char *myrtopts[] = { "-I-", "-i-", "-ov", "-h-", "-fff", "-y", "0", NULL }; struct rtproc rt; /* our rtrace process */ @@ -42,6 +42,7 @@ struct illum_args thisillum = { /* our illum and defa VOIDID, SAMPDENS, NSAMPS, + 0., }; char matcheck[MAXSTR]; /* current material to include or exclude */ @@ -75,14 +76,29 @@ char *argv[]; gargv = argv; /* set up rtrace command */ for (i = 1; i < argc; i++) { - if (argv[i][0] == '<' && !argv[i][1]) + if (argv[i][0] == '<' && argv[i][1] == '\0') break; rtargv[rtargc++] = argv[i]; if (argv[i][0] == '-' && argv[i][1] == 'w') - warnings = !warnings; + switch (argv[i][2]) { + case '\0': + warnings = !warnings; + break; + case '+': + case 'T': case 't': + case 'Y': case 'y': + case '1': + warnings = 1; + break; + case '-': + case 'F': case 'f': + case 'N': case 'n': + case '0': + warnings = 0; + break; + } } - if ((gargc = i) < 2) - error(USER, "too few arguments"); + gargc = i; rtargc--; for (i = 0; myrtopts[i] != NULL; i++) rtargv[rtargc++] = myrtopts[i]; @@ -101,6 +117,8 @@ char *argv[]; perror(rtpath); exit(1); } + if (gargc < 2 || argv[gargc-1][0] == '-') + error(USER, "missing octree argument"); /* else initialize and run our calculation */ init(); if (gargc+1 < argc) @@ -146,6 +164,7 @@ init() /* start rtrace and set up buffers */ /* set up signal handling */ signal(SIGPIPE, quit); /* start rtrace process */ + errno = 0; maxbytes = open_process(rt.pd, rtargv); if (maxbytes == 0) { eputs(rtargv[0]); @@ -161,7 +180,7 @@ init() /* start rtrace and set up buffers */ error(SYSTEM, "out of memory in init"); rt.nrays = 0; /* set up urand */ - initurand(2048); + initurand(16384); } @@ -244,7 +263,7 @@ char *nm; case 'm': /* material name */ if (*++cp != '=') break; - if (!*++cp) + if (!*++cp || isspace(*cp)) break; atos(thisillum.matname, MAXSTR, cp); cp = sskip(cp); @@ -256,7 +275,7 @@ char *nm; case 'f': /* data file name */ if (*++cp != '=') break; - if (!*++cp) { + if (!*++cp || isspace(*cp)) { strcpy(thisillum.datafile,thisillum.matname); thisillum.dfnum = 0; thisillum.flags &= ~IL_DATCLB; @@ -329,10 +348,20 @@ char *nm; break; cp++; continue; + case 'b': /* brightness */ + if (*++cp != '=') + break; + if (!isfltd(++cp, " \t\n")) + break; + thisillum.minbrt = atof(cp); + if (thisillum.minbrt < 0.) + thisillum.minbrt = 0.; + cp = sskip(cp); + continue; case 'o': /* output file */ if (*++cp != '=') break; - if (!*++cp) + if (!*++cp || isspace(*cp)) break; atos(buf, sizeof(buf), cp); cp = sskip(cp); @@ -350,7 +379,8 @@ char *nm; return; } opterr: /* skip faulty option */ - cp = sskip(cp); + while (*cp && !isspace(*cp)) + cp++; nerrs++; } /* print header? */ @@ -373,9 +403,20 @@ printopts() /* print out option default values */ { printf("m=%-15s\t\t# material name\n", thisillum.matname); printf("f=%-15s\t\t# data file name\n", thisillum.datafile); - printf("c=n\t\t\t\t# color none\n"); + if (thisillum.flags & IL_COLAVG) + if (thisillum.flags & IL_COLDST) + printf("c=d\t\t\t\t# color distribution\n"); + else + printf("c=a\t\t\t\t# color average\n"); + else + printf("c=n\t\t\t\t# color none\n"); + if (thisillum.flags & IL_LIGHT) + 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("b=%f\t\t\t# minimum average brightness\n", thisillum.minbrt); }