| 1 |
– |
/* Copyright (c) 1991 Regents of the University of California */ |
| 2 |
– |
|
| 1 |
|
#ifndef lint |
| 2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
| 2 |
> |
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 6 |
– |
|
| 4 |
|
/* |
| 5 |
|
* Make illum sources for optimizing rendering process |
| 6 |
|
*/ |
| 27 |
|
"-ab", "2", "-ad", "256", "-as", "128", "-aa", ".15", }; |
| 28 |
|
int rtargc = 14; |
| 29 |
|
/* overriding rtrace options */ |
| 30 |
< |
char *myrtopts[] = { "-I-", "-i-", "-ov", "-h-", "-fff", "-y", "0", NULL }; |
| 30 |
> |
char *myrtopts[] = { "-I-", "-i-", "-ld-", "-ov", "-h-", |
| 31 |
> |
"-fff", "-y", "0", NULL }; |
| 32 |
|
|
| 33 |
|
struct rtproc rt; /* our rtrace process */ |
| 34 |
|
|
| 57 |
|
|
| 58 |
|
int warnings = 1; /* print warnings? */ |
| 59 |
|
|
| 62 |
– |
extern char *fgetline(), *fgetword(), *sskip(), |
| 63 |
– |
*atos(), *iskip(), *fskip(), *strcpy(); |
| 64 |
– |
extern FILE *popen(); |
| 60 |
|
|
| 66 |
– |
|
| 61 |
|
main(argc, argv) /* compute illum distributions using rtrace */ |
| 62 |
|
int argc; |
| 63 |
|
char *argv[]; |
| 64 |
|
{ |
| 71 |
– |
extern char *getenv(), *getpath(); |
| 65 |
|
char *rtpath; |
| 66 |
|
FILE *fp; |
| 67 |
|
register int i; |
| 130 |
|
} |
| 131 |
|
|
| 132 |
|
|
| 133 |
+ |
void |
| 134 |
|
quit(status) /* exit with status */ |
| 135 |
|
int status; |
| 136 |
|
{ |
| 174 |
|
error(SYSTEM, "out of memory in init"); |
| 175 |
|
rt.nrays = 0; |
| 176 |
|
/* set up urand */ |
| 177 |
< |
initurand(2048); |
| 177 |
> |
initurand(16384); |
| 178 |
|
} |
| 179 |
|
|
| 180 |
|
|
| 181 |
+ |
void |
| 182 |
|
eputs(s) /* put string to stderr */ |
| 183 |
|
register char *s; |
| 184 |
|
{ |
| 194 |
|
} |
| 195 |
|
|
| 196 |
|
|
| 197 |
+ |
void |
| 198 |
|
wputs(s) /* print warning if enabled */ |
| 199 |
|
char *s; |
| 200 |
|
{ |
| 254 |
|
case ' ': |
| 255 |
|
case '\t': |
| 256 |
|
case '\n': |
| 257 |
+ |
case '\r': |
| 258 |
+ |
case '\f': |
| 259 |
|
cp++; |
| 260 |
|
continue; |
| 261 |
|
case 'm': /* material name */ |
| 262 |
|
if (*++cp != '=') |
| 263 |
|
break; |
| 264 |
< |
if (!*++cp) |
| 264 |
> |
if (!*++cp || isspace(*cp)) |
| 265 |
|
break; |
| 266 |
|
atos(thisillum.matname, MAXSTR, cp); |
| 267 |
|
cp = sskip(cp); |
| 273 |
|
case 'f': /* data file name */ |
| 274 |
|
if (*++cp != '=') |
| 275 |
|
break; |
| 276 |
< |
if (!*++cp) { |
| 276 |
> |
if (!*++cp || isspace(*cp)) { |
| 277 |
|
strcpy(thisillum.datafile,thisillum.matname); |
| 278 |
|
thisillum.dfnum = 0; |
| 279 |
|
thisillum.flags &= ~IL_DATCLB; |
| 323 |
|
case 'd': /* point sample density */ |
| 324 |
|
if (*++cp != '=') |
| 325 |
|
break; |
| 326 |
< |
if (!isintd(++cp, " \t\n")) |
| 326 |
> |
if (!isintd(++cp, " \t\n\r")) |
| 327 |
|
break; |
| 328 |
|
thisillum.sampdens = atoi(cp); |
| 329 |
|
cp = sskip(cp); |
| 331 |
|
case 's': /* point super-samples */ |
| 332 |
|
if (*++cp != '=') |
| 333 |
|
break; |
| 334 |
< |
if (!isintd(++cp, " \t\n")) |
| 334 |
> |
if (!isintd(++cp, " \t\n\r")) |
| 335 |
|
break; |
| 336 |
|
thisillum.nsamps = atoi(cp); |
| 337 |
|
cp = sskip(cp); |
| 349 |
|
case 'b': /* brightness */ |
| 350 |
|
if (*++cp != '=') |
| 351 |
|
break; |
| 352 |
< |
if (!isfltd(++cp, " \t\n")) |
| 352 |
> |
if (!isfltd(++cp, " \t\n\r")) |
| 353 |
|
break; |
| 354 |
|
thisillum.minbrt = atof(cp); |
| 355 |
|
if (thisillum.minbrt < 0.) |
| 359 |
|
case 'o': /* output file */ |
| 360 |
|
if (*++cp != '=') |
| 361 |
|
break; |
| 362 |
< |
if (!*++cp) |
| 362 |
> |
if (!*++cp || isspace(*cp)) |
| 363 |
|
break; |
| 364 |
|
atos(buf, sizeof(buf), cp); |
| 365 |
|
cp = sskip(cp); |
| 377 |
|
return; |
| 378 |
|
} |
| 379 |
|
opterr: /* skip faulty option */ |
| 380 |
< |
cp = sskip(cp); |
| 380 |
> |
while (*cp && !isspace(*cp)) |
| 381 |
> |
cp++; |
| 382 |
|
nerrs++; |
| 383 |
|
} |
| 384 |
|
/* print header? */ |
| 444 |
|
if (fgetword(str, MAXSTR, fp) == NULL) |
| 445 |
|
goto readerr; |
| 446 |
|
/* is it an alias? */ |
| 447 |
< |
if (!strcmp(str, ALIASID)) { |
| 447 |
> |
if (!strcmp(str, ALIASKEY)) { |
| 448 |
|
if (fgetword(str, MAXSTR, fp) == NULL) |
| 449 |
|
goto readerr; |
| 450 |
< |
printf("\n%s %s %s", thisillum.altmat, ALIASID, str); |
| 450 |
> |
printf("\n%s %s %s", thisillum.altmat, ALIASKEY, str); |
| 451 |
|
if (fgetword(str, MAXSTR, fp) == NULL) |
| 452 |
|
goto readerr; |
| 453 |
|
printf("\t%s\n", str); |