15 |
|
#include <ctype.h> |
16 |
|
|
17 |
|
/* default parameters */ |
18 |
< |
#define SAMPDENS 128 /* points per projected steradian */ |
18 |
> |
#define SAMPDENS 48 /* points per projected steradian */ |
19 |
|
#define NSAMPS 32 /* samples per point */ |
20 |
|
#define DFLMAT "illum_mat" /* material name */ |
21 |
+ |
#define DFLDAT "illum" /* data file name */ |
22 |
|
/* selection options */ |
23 |
|
#define S_NONE 0 /* select none */ |
24 |
|
#define S_ELEM 1 /* select specified element */ |
37 |
|
struct illum_args thisillum = { /* our illum and default values */ |
38 |
|
0, |
39 |
|
DFLMAT, |
40 |
< |
DFLMAT, |
40 |
> |
DFLDAT, |
41 |
|
0, |
42 |
|
VOIDID, |
43 |
|
SAMPDENS, |
59 |
|
int warnings = 1; /* print warnings? */ |
60 |
|
|
61 |
|
extern char *fgetline(), *fgetword(), *sskip(), |
62 |
< |
*atos(), *iskip(), *fskip(); |
62 |
> |
*atos(), *iskip(), *fskip(), *strcpy(); |
63 |
|
extern FILE *popen(); |
64 |
|
|
65 |
|
|
90 |
|
rtargv[rtargc] = NULL; |
91 |
|
/* just asking for defaults? */ |
92 |
|
if (!strcmp(argv[gargc-1], "-defaults")) { |
93 |
+ |
printopts(); fflush(stdout); |
94 |
|
rtpath = getpath(rtargv[0], getenv("PATH"), X_OK); |
95 |
|
if (rtpath == NULL) { |
96 |
|
eputs(rtargv[0]); |
160 |
|
if (rt.buf == NULL || rt.dest == NULL) |
161 |
|
error(SYSTEM, "out of memory in init"); |
162 |
|
rt.nrays = 0; |
163 |
+ |
/* set up urand */ |
164 |
+ |
initurand(2048); |
165 |
|
} |
166 |
|
|
167 |
|
|
257 |
|
if (*++cp != '=') |
258 |
|
break; |
259 |
|
if (!*++cp) { |
260 |
+ |
strcpy(thisillum.datafile,thisillum.matname); |
261 |
+ |
thisillum.dfnum = 0; |
262 |
|
thisillum.flags &= ~IL_DATCLB; |
263 |
|
continue; |
264 |
|
} |
269 |
|
continue; |
270 |
|
case 'i': /* include material */ |
271 |
|
case 'e': /* exclude material */ |
272 |
< |
matselect = (*cp == 'i') ? S_ELEM : S_COMPL; |
267 |
< |
if (*++cp != '=') |
272 |
> |
if (cp[1] != '=') |
273 |
|
break; |
274 |
< |
atos(matcheck, MAXSTR, ++cp); |
274 |
> |
matselect = (*cp == 'i') ? S_ELEM : S_COMPL; |
275 |
> |
cp += 2; |
276 |
> |
atos(matcheck, MAXSTR, cp); |
277 |
|
cp = sskip(cp); |
278 |
|
continue; |
279 |
|
case 'a': /* use everything */ |
289 |
|
break; |
290 |
|
switch (*++cp) { |
291 |
|
case 'a': /* average */ |
292 |
< |
thisillum.flags |= IL_COLAVG; |
293 |
< |
thisillum.flags &= ~IL_COLDST; |
292 |
> |
thisillum.flags = (thisillum.flags|IL_COLAVG) |
293 |
> |
& ~IL_COLDST; |
294 |
|
break; |
295 |
|
case 'd': /* distribution */ |
296 |
|
thisillum.flags |= (IL_COLDST|IL_COLAVG); |
343 |
|
} |
344 |
|
doneheader = 0; |
345 |
|
continue; |
346 |
+ |
case '!': /* processed file! */ |
347 |
+ |
sprintf(errmsg, "(%s): already processed!", nm); |
348 |
+ |
error(WARNING, errmsg); |
349 |
+ |
matselect = S_NONE; |
350 |
+ |
return; |
351 |
|
} |
352 |
|
opterr: /* skip faulty option */ |
353 |
|
cp = sskip(cp); |
369 |
|
} |
370 |
|
|
371 |
|
|
372 |
+ |
printopts() /* print out option default values */ |
373 |
+ |
{ |
374 |
+ |
printf("m=%s\t\t\t# material name\n", thisillum.matname); |
375 |
+ |
printf("f=%s\t\t\t# data file name\n", thisillum.datafile); |
376 |
+ |
printf("c=n\t\t\t\t# color none\n"); |
377 |
+ |
printf("d=%d\t\t\t\t# density of points\n", thisillum.sampdens); |
378 |
+ |
printf("s=%d\t\t\t\t# samples per point\n", thisillum.nsamps); |
379 |
+ |
} |
380 |
+ |
|
381 |
+ |
|
382 |
|
printhead(ac, av) /* print out header */ |
383 |
|
register int ac; |
384 |
|
register char **av; |
388 |
|
putchar(' '); |
389 |
|
fputs(*av++, stdout); |
390 |
|
} |
391 |
< |
putchar('\n'); |
391 |
> |
fputs("\n#@mkillum !\n", stdout); |
392 |
|
} |
393 |
|
|
394 |
|
|