1 |
< |
/* Copyright (c) 1994 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1995 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
10 |
|
|
11 |
|
#include "standard.h" |
12 |
|
#include "paths.h" |
13 |
+ |
#include "vars.h" |
14 |
|
#include <ctype.h> |
15 |
|
#include <sys/types.h> |
16 |
|
|
16 |
– |
|
17 |
– |
typedef struct { |
18 |
– |
char *name; /* variable name */ |
19 |
– |
short nick; /* # characters required for nickname */ |
20 |
– |
short nass; /* # assignments made */ |
21 |
– |
char *value; /* assigned value(s) */ |
22 |
– |
int (*fixval)(); /* assignment checking function */ |
23 |
– |
} VARIABLE; |
24 |
– |
|
25 |
– |
int onevalue(), catvalues(), boolvalue(), |
26 |
– |
qualvalue(), fltvalue(), intvalue(); |
27 |
– |
|
17 |
|
/* variables */ |
18 |
|
#define OBJECT 0 /* object files */ |
19 |
|
#define SCENE 1 /* scene files */ |
27 |
|
#define ZONE 9 /* simulation zone */ |
28 |
|
#define QUALITY 10 /* desired rendering quality */ |
29 |
|
#define OCTREE 11 /* octree file name */ |
30 |
< |
#define PICTURE 12 /* picture file name */ |
30 |
> |
#define PICTURE 12 /* picture file root name */ |
31 |
|
#define AMBFILE 13 /* ambient file name */ |
32 |
|
#define OPTFILE 14 /* rendering options file */ |
33 |
|
#define EXPOSURE 15 /* picture exposure setting */ |
38 |
|
#define PENUMBRAS 20 /* shadow penumbras are desired */ |
39 |
|
#define VARIABILITY 21 /* level of light variability */ |
40 |
|
#define REPORT 22 /* report frequency and errfile */ |
41 |
< |
#define RAWSAVE 23 /* save raw picture file */ |
41 |
> |
#define RAWFILE 23 /* raw picture file root name */ |
42 |
> |
#define ZFILE 24 /* distance file root name */ |
43 |
|
/* total number of variables */ |
44 |
< |
#define NVARS 24 |
44 |
> |
int NVARS = 25; |
45 |
|
|
46 |
< |
VARIABLE vv[NVARS] = { /* variable-value pairs */ |
46 |
> |
VARIABLE vv[] = { /* variable-value pairs */ |
47 |
|
{"objects", 3, 0, NULL, catvalues}, |
48 |
|
{"scene", 3, 0, NULL, catvalues}, |
49 |
|
{"materials", 3, 0, NULL, catvalues}, |
67 |
|
{"PENUMBRAS", 3, 0, NULL, boolvalue}, |
68 |
|
{"VARIABILITY", 3, 0, NULL, qualvalue}, |
69 |
|
{"REPORT", 3, 0, NULL, onevalue}, |
70 |
< |
{"RAWSAVE", 3, 0, NULL, boolvalue}, |
70 |
> |
{"RAWFILE", 3, 0, NULL, onevalue}, |
71 |
> |
{"ZFILE", 2, 0, NULL, onevalue}, |
72 |
|
}; |
73 |
|
|
83 |
– |
VARIABLE *matchvar(); |
84 |
– |
char *nvalue(); |
85 |
– |
|
86 |
– |
#define UPPER(c) ((c)&~0x20) /* ASCII trick */ |
87 |
– |
|
88 |
– |
#define vnam(vc) (vv[vc].name) |
89 |
– |
#define vdef(vc) (vv[vc].nass) |
90 |
– |
#define vval(vc) (vv[vc].value) |
91 |
– |
#define vint(vc) atoi(vval(vc)) |
92 |
– |
#define vlet(vc) UPPER(vval(vc)[0]) |
93 |
– |
#define vscale vlet |
94 |
– |
#define vbool(vc) (vlet(vc)=='T') |
95 |
– |
|
96 |
– |
#define HIGH 'H' |
97 |
– |
#define MEDIUM 'M' |
98 |
– |
#define LOW 'L' |
99 |
– |
|
74 |
|
/* overture calculation file */ |
75 |
|
#ifdef NIX |
76 |
< |
char overfile[] = "overture.raw"; |
76 |
> |
char overfile[] = "overture.unf"; |
77 |
|
#else |
78 |
|
char overfile[] = "/dev/null"; |
79 |
|
#endif |
152 |
|
/* assign Radiance root file name */ |
153 |
|
rootname(radname, rifname); |
154 |
|
/* load variable values */ |
155 |
< |
load(rifname); |
155 |
> |
loadvars(rifname); |
156 |
|
/* get any additional assignments */ |
157 |
|
for (i++; i < argc; i++) |
158 |
|
setvariable(argv[i]); |
164 |
|
setdefaults(); |
165 |
|
/* print all values if requested */ |
166 |
|
if (explicate) |
167 |
< |
printvals(); |
167 |
> |
printvars(stdout); |
168 |
|
/* build octree (and run mkillum) */ |
169 |
|
oconv(); |
170 |
|
/* check date on ambient file */ |
200 |
|
} |
201 |
|
|
202 |
|
|
229 |
– |
#define NOCHAR 127 /* constant for character to delete */ |
230 |
– |
|
231 |
– |
|
232 |
– |
load(rfname) /* load Radiance simulation file */ |
233 |
– |
char *rfname; |
234 |
– |
{ |
235 |
– |
FILE *fp; |
236 |
– |
char buf[512]; |
237 |
– |
register char *cp; |
238 |
– |
|
239 |
– |
if (rfname == NULL) |
240 |
– |
fp = stdin; |
241 |
– |
else if ((fp = fopen(rfname, "r")) == NULL) |
242 |
– |
syserr(rfname); |
243 |
– |
while (fgetline(buf, sizeof(buf), fp) != NULL) { |
244 |
– |
for (cp = buf; *cp; cp++) { |
245 |
– |
switch (*cp) { |
246 |
– |
case '\\': |
247 |
– |
*cp++ = NOCHAR; |
248 |
– |
continue; |
249 |
– |
case '#': |
250 |
– |
*cp = '\0'; |
251 |
– |
break; |
252 |
– |
default: |
253 |
– |
continue; |
254 |
– |
} |
255 |
– |
break; |
256 |
– |
} |
257 |
– |
setvariable(buf); |
258 |
– |
} |
259 |
– |
fclose(fp); |
260 |
– |
} |
261 |
– |
|
262 |
– |
|
263 |
– |
setvariable(ass) /* assign variable according to string */ |
264 |
– |
register char *ass; |
265 |
– |
{ |
266 |
– |
char varname[32]; |
267 |
– |
int n; |
268 |
– |
register char *cp; |
269 |
– |
register VARIABLE *vp; |
270 |
– |
register int i; |
271 |
– |
|
272 |
– |
while (isspace(*ass)) /* skip leading space */ |
273 |
– |
ass++; |
274 |
– |
cp = varname; /* extract name */ |
275 |
– |
while (cp < varname+sizeof(varname)-1 |
276 |
– |
&& *ass && !isspace(*ass) && *ass != '=') |
277 |
– |
*cp++ = *ass++; |
278 |
– |
*cp = '\0'; |
279 |
– |
if (!varname[0]) |
280 |
– |
return; /* no variable name! */ |
281 |
– |
/* trim value */ |
282 |
– |
while (isspace(*ass) || *ass == '=') |
283 |
– |
ass++; |
284 |
– |
for (n = strlen(ass); n > 0; n--) |
285 |
– |
if (!isspace(ass[n-1])) |
286 |
– |
break; |
287 |
– |
if (!n && !nowarn) { |
288 |
– |
fprintf(stderr, "%s: warning - missing value for variable '%s'\n", |
289 |
– |
progname, varname); |
290 |
– |
return; |
291 |
– |
} |
292 |
– |
/* match variable from list */ |
293 |
– |
vp = matchvar(varname); |
294 |
– |
if (vp == NULL) { |
295 |
– |
fprintf(stderr, "%s: unknown variable '%s'\n", |
296 |
– |
progname, varname); |
297 |
– |
exit(1); |
298 |
– |
} |
299 |
– |
/* assign new value */ |
300 |
– |
if (i = vp->nass) { |
301 |
– |
cp = vp->value; |
302 |
– |
while (i--) |
303 |
– |
while (*cp++) |
304 |
– |
; |
305 |
– |
i = cp - vp->value; |
306 |
– |
vp->value = realloc(vp->value, i+n+1); |
307 |
– |
} else |
308 |
– |
vp->value = malloc(n+1); |
309 |
– |
if (vp->value == NULL) |
310 |
– |
syserr(progname); |
311 |
– |
cp = vp->value+i; /* copy value, squeezing spaces */ |
312 |
– |
*cp = *ass; |
313 |
– |
for (i = 1; i <= n; i++) { |
314 |
– |
if (ass[i] == NOCHAR) |
315 |
– |
continue; |
316 |
– |
if (isspace(*cp)) |
317 |
– |
while (isspace(ass[i])) |
318 |
– |
i++; |
319 |
– |
*++cp = ass[i]; |
320 |
– |
} |
321 |
– |
if (isspace(*cp)) /* remove trailing space */ |
322 |
– |
*cp = '\0'; |
323 |
– |
vp->nass++; |
324 |
– |
} |
325 |
– |
|
326 |
– |
|
327 |
– |
VARIABLE * |
328 |
– |
matchvar(nam) /* match a variable by its name */ |
329 |
– |
char *nam; |
330 |
– |
{ |
331 |
– |
int n = strlen(nam); |
332 |
– |
register int i; |
333 |
– |
|
334 |
– |
for (i = 0; i < NVARS; i++) |
335 |
– |
if (n >= vv[i].nick && !strncmp(nam, vv[i].name, n)) |
336 |
– |
return(vv+i); |
337 |
– |
return(NULL); |
338 |
– |
} |
339 |
– |
|
340 |
– |
|
341 |
– |
char * |
342 |
– |
nvalue(vp, n) /* return nth variable value */ |
343 |
– |
VARIABLE *vp; |
344 |
– |
register int n; |
345 |
– |
{ |
346 |
– |
register char *cp; |
347 |
– |
|
348 |
– |
if (vp == NULL | n < 0 | n >= vp->nass) |
349 |
– |
return(NULL); |
350 |
– |
cp = vp->value; |
351 |
– |
while (n--) |
352 |
– |
while (*cp++) |
353 |
– |
; |
354 |
– |
return(cp); |
355 |
– |
} |
356 |
– |
|
357 |
– |
|
358 |
– |
checkvalues() /* check assignments */ |
359 |
– |
{ |
360 |
– |
register int i; |
361 |
– |
|
362 |
– |
for (i = 0; i < NVARS; i++) |
363 |
– |
if (vv[i].fixval != NULL) |
364 |
– |
(*vv[i].fixval)(vv+i); |
365 |
– |
} |
366 |
– |
|
367 |
– |
|
368 |
– |
onevalue(vp) /* only one assignment for this variable */ |
369 |
– |
register VARIABLE *vp; |
370 |
– |
{ |
371 |
– |
if (vp->nass < 2) |
372 |
– |
return; |
373 |
– |
if (!nowarn) |
374 |
– |
fprintf(stderr, |
375 |
– |
"%s: warning - multiple assignment of variable '%s'\n", |
376 |
– |
progname, vp->name); |
377 |
– |
do |
378 |
– |
vp->value += strlen(vp->value)+1; |
379 |
– |
while (--vp->nass > 1); |
380 |
– |
} |
381 |
– |
|
382 |
– |
|
383 |
– |
catvalues(vp) /* concatenate variable values */ |
384 |
– |
register VARIABLE *vp; |
385 |
– |
{ |
386 |
– |
register char *cp; |
387 |
– |
|
388 |
– |
if (vp->nass < 2) |
389 |
– |
return; |
390 |
– |
for (cp = vp->value; vp->nass > 1; vp->nass--) { |
391 |
– |
while (*cp) |
392 |
– |
cp++; |
393 |
– |
*cp++ = ' '; |
394 |
– |
} |
395 |
– |
} |
396 |
– |
|
397 |
– |
|
398 |
– |
int |
399 |
– |
badmatch(tv, cv) /* case insensitive truncated comparison */ |
400 |
– |
register char *tv, *cv; |
401 |
– |
{ |
402 |
– |
if (!*tv) return(1); /* null string cannot match */ |
403 |
– |
do |
404 |
– |
if (UPPER(*tv) != *cv++) |
405 |
– |
return(1); |
406 |
– |
while (*++tv); |
407 |
– |
return(0); /* OK */ |
408 |
– |
} |
409 |
– |
|
410 |
– |
|
411 |
– |
boolvalue(vp) /* check boolean for legal values */ |
412 |
– |
register VARIABLE *vp; |
413 |
– |
{ |
414 |
– |
if (!vp->nass) return; |
415 |
– |
onevalue(vp); |
416 |
– |
switch (UPPER(vp->value[0])) { |
417 |
– |
case 'T': |
418 |
– |
if (badmatch(vp->value, "TRUE")) break; |
419 |
– |
return; |
420 |
– |
case 'F': |
421 |
– |
if (badmatch(vp->value, "FALSE")) break; |
422 |
– |
return; |
423 |
– |
} |
424 |
– |
fprintf(stderr, "%s: illegal value for boolean variable '%s'\n", |
425 |
– |
progname, vp->name); |
426 |
– |
exit(1); |
427 |
– |
} |
428 |
– |
|
429 |
– |
|
430 |
– |
qualvalue(vp) /* check qualitative var. for legal values */ |
431 |
– |
register VARIABLE *vp; |
432 |
– |
{ |
433 |
– |
if (!vp->nass) return; |
434 |
– |
onevalue(vp); |
435 |
– |
switch (UPPER(vp->value[0])) { |
436 |
– |
case 'L': |
437 |
– |
if (badmatch(vp->value, "LOW")) break; |
438 |
– |
return; |
439 |
– |
case 'M': |
440 |
– |
if (badmatch(vp->value, "MEDIUM")) break; |
441 |
– |
return; |
442 |
– |
case 'H': |
443 |
– |
if (badmatch(vp->value, "HIGH")) break; |
444 |
– |
return; |
445 |
– |
} |
446 |
– |
fprintf(stderr, "%s: illegal value for qualitative variable '%s'\n", |
447 |
– |
progname, vp->name); |
448 |
– |
exit(1); |
449 |
– |
} |
450 |
– |
|
451 |
– |
|
452 |
– |
intvalue(vp) /* check integer variable for legal values */ |
453 |
– |
register VARIABLE *vp; |
454 |
– |
{ |
455 |
– |
if (!vp->nass) return; |
456 |
– |
onevalue(vp); |
457 |
– |
if (isint(vp->value)) return; |
458 |
– |
fprintf(stderr, "%s: illegal value for integer variable '%s'\n", |
459 |
– |
progname, vp->name); |
460 |
– |
exit(1); |
461 |
– |
} |
462 |
– |
|
463 |
– |
|
464 |
– |
fltvalue(vp) /* check float variable for legal values */ |
465 |
– |
register VARIABLE *vp; |
466 |
– |
{ |
467 |
– |
if (!vp->nass) return; |
468 |
– |
onevalue(vp); |
469 |
– |
if (isflt(vp->value)) return; |
470 |
– |
fprintf(stderr, "%s: illegal value for real variable '%s'\n", |
471 |
– |
progname, vp->name); |
472 |
– |
exit(1); |
473 |
– |
} |
474 |
– |
|
475 |
– |
|
203 |
|
time_t |
204 |
|
checklast(fnames) /* check files and find most recent */ |
205 |
|
register char *fnames; |
288 |
|
extern FILE *popen(); |
289 |
|
static double oorg[3], osiz = 0.; |
290 |
|
double min[3], max[3]; |
291 |
< |
char buf[512]; |
291 |
> |
char buf[1024]; |
292 |
|
FILE *fp; |
293 |
|
register int i; |
294 |
|
|
376 |
|
vval(VARIABILITY) = "L"; |
377 |
|
vdef(VARIABILITY)++; |
378 |
|
} |
652 |
– |
if (!vdef(RAWSAVE)) { |
653 |
– |
vval(RAWSAVE) = "F"; |
654 |
– |
vdef(RAWSAVE)++; |
655 |
– |
} |
379 |
|
} |
380 |
|
|
381 |
|
|
659 |
– |
printvals() /* print variable values */ |
660 |
– |
{ |
661 |
– |
int i, j, clipline; |
662 |
– |
register char *cp; |
663 |
– |
register int k; |
664 |
– |
|
665 |
– |
for (i = 0; i < NVARS; i++) /* print each variable */ |
666 |
– |
for (j = 0; j < vdef(i); j++) { /* print each assignment */ |
667 |
– |
fputs(vnam(i), stdout); |
668 |
– |
fputs("= ", stdout); |
669 |
– |
k = clipline = ( vv[i].fixval == catvalues ? 64 : 320 ) |
670 |
– |
- strlen(vnam(i)) ; |
671 |
– |
cp = nvalue(vv+i, j); |
672 |
– |
while (*cp) { |
673 |
– |
putchar(*cp++); |
674 |
– |
if (--k <= 0) { /* line too long */ |
675 |
– |
while (*cp && !isspace(*cp)) |
676 |
– |
putchar(*cp++); /* finish this word */ |
677 |
– |
if (*cp) { /* start new line */ |
678 |
– |
putchar('\n'); |
679 |
– |
fputs(vnam(i), stdout); |
680 |
– |
putchar('='); |
681 |
– |
k = clipline; |
682 |
– |
} |
683 |
– |
} |
684 |
– |
} |
685 |
– |
putchar('\n'); |
686 |
– |
} |
687 |
– |
fflush(stdout); |
688 |
– |
} |
689 |
– |
|
690 |
– |
|
382 |
|
oconv() /* run oconv and mkillum if necessary */ |
383 |
|
{ |
384 |
|
static char illumtmp[] = "ilXXXXXX"; |
385 |
< |
char combuf[512], ocopts[64], mkopts[64]; |
385 |
> |
char combuf[1024], ocopts[64], mkopts[64]; |
386 |
|
|
387 |
|
oconvopts(ocopts); /* get options */ |
388 |
|
if (octreedate < scenedate) { /* check date on original octree */ |
470 |
|
"%s: error generating octree\n\t%s removed\n", |
471 |
|
progname, oct1name); |
472 |
|
unlink(oct1name); |
473 |
+ |
unlink(illumtmp); |
474 |
|
exit(1); |
475 |
|
} |
476 |
|
rmfile(illumtmp); |
535 |
|
{ |
536 |
|
if (vdef(EXPOSURE)) { |
537 |
|
if (vval(EXPOSURE)[0] == '+' || vval(EXPOSURE)[0] == '-') |
538 |
< |
return(.5/pow(2.,atof(vval(EXPOSURE)))); |
539 |
< |
return(.5/atof(vval(EXPOSURE))); |
538 |
> |
return(.5/pow(2.,vflt(EXPOSURE))); |
539 |
> |
return(.5/vflt(EXPOSURE)); |
540 |
|
} |
541 |
|
if (vlet(ZONE) == 'E') |
542 |
|
return(10.); |
612 |
|
overture = 0; |
613 |
|
switch (vscale(VARIABILITY)) { |
614 |
|
case LOW: |
615 |
< |
op = addarg(op, "-aa .4 -ad 64"); |
615 |
> |
op = addarg(op, "-aw 128 -aa .4 -ad 64"); |
616 |
|
break; |
617 |
|
case MEDIUM: |
618 |
< |
op = addarg(op, "-aa .3 -ad 128"); |
618 |
> |
op = addarg(op, "-aw 1024 -aa .3 -ad 128"); |
619 |
|
break; |
620 |
|
case HIGH: |
621 |
|
op = addarg(op, "-aa .25 -ad 256"); |
635 |
|
register char *op; |
636 |
|
char *po; |
637 |
|
{ |
638 |
< |
double d, org[3], siz[3]; |
638 |
> |
double d, org[3], siz[3], asz; |
639 |
|
|
640 |
|
*op = '\0'; |
641 |
|
*po = '\0'; |
646 |
|
if (siz[0] <= FTINY | siz[1] <= FTINY | siz[2] <= FTINY) |
647 |
|
badvalue(ZONE); |
648 |
|
getoctcube(org, &d); |
649 |
< |
d *= 3./(siz[0]+siz[1]+siz[2]); |
649 |
> |
asz = (siz[0]+siz[1]+siz[2])/3.; |
650 |
> |
d /= asz; |
651 |
|
switch (vscale(DETAIL)) { |
652 |
|
case LOW: |
653 |
|
po = addarg(po, vbool(PENUMBRAS) ? "-ps 4" : "-ps 8"); |
654 |
|
op = addarg(op, "-dp 256"); |
655 |
|
sprintf(op, " -ar %d", (int)(8*d)); |
656 |
|
op += strlen(op); |
657 |
+ |
sprintf(op, " -ms %.2g", asz/20.); |
658 |
+ |
op += strlen(op); |
659 |
|
break; |
660 |
|
case MEDIUM: |
661 |
|
po = addarg(po, vbool(PENUMBRAS) ? "-ps 3" : "-ps 6"); |
662 |
|
op = addarg(op, "-dp 512"); |
663 |
|
sprintf(op, " -ar %d", (int)(16*d)); |
664 |
|
op += strlen(op); |
665 |
+ |
sprintf(op, " -ms %.2g", asz/40.); |
666 |
+ |
op += strlen(op); |
667 |
|
break; |
668 |
|
case HIGH: |
669 |
|
po = addarg(po, vbool(PENUMBRAS) ? "-ps 2" : "-ps 4"); |
670 |
|
op = addarg(op, "-dp 1024"); |
671 |
|
sprintf(op, " -ar %d", (int)(32*d)); |
672 |
|
op += strlen(op); |
673 |
+ |
sprintf(op, " -ms %.2g", asz/80.); |
674 |
+ |
op += strlen(op); |
675 |
|
break; |
676 |
|
} |
677 |
|
po = addarg(po, "-pt .08"); |
691 |
|
overture = 0; |
692 |
|
switch (vscale(VARIABILITY)) { |
693 |
|
case LOW: |
694 |
< |
op = addarg(op, "-aa .25 -ad 196 -as 0"); |
694 |
> |
op = addarg(op, "-aw 128 -aa .25 -ad 196 -as 0"); |
695 |
|
break; |
696 |
|
case MEDIUM: |
697 |
< |
op = addarg(op, "-aa .2 -ad 400 -as 64"); |
697 |
> |
op = addarg(op, "-aw 1024 -aa .2 -ad 400 -as 64"); |
698 |
|
break; |
699 |
|
case HIGH: |
700 |
|
op = addarg(op, "-aa .15 -ad 768 -as 196"); |
713 |
|
register char *op; |
714 |
|
char *po; |
715 |
|
{ |
716 |
< |
double d, org[3], siz[3]; |
716 |
> |
double d, org[3], siz[3], asz; |
717 |
|
|
718 |
|
*op = '\0'; |
719 |
|
*po = '\0'; |
724 |
|
if (siz[0] <= FTINY | siz[1] <= FTINY | siz[2] <= FTINY) |
725 |
|
badvalue(ZONE); |
726 |
|
getoctcube(org, &d); |
727 |
< |
d *= 3./(siz[0]+siz[1]+siz[2]); |
727 |
> |
asz = (siz[0]+siz[1]+siz[2])/3.; |
728 |
> |
d /= asz; |
729 |
|
switch (vscale(DETAIL)) { |
730 |
|
case LOW: |
731 |
|
po = addarg(po, vbool(PENUMBRAS) ? "-ps 1" : "-ps 8"); |
732 |
|
op = addarg(op, "-dp 1024"); |
733 |
|
sprintf(op, " -ar %d", (int)(16*d)); |
734 |
|
op += strlen(op); |
735 |
+ |
sprintf(op, " -ms %.2g", asz/40.); |
736 |
+ |
op += strlen(op); |
737 |
|
break; |
738 |
|
case MEDIUM: |
739 |
|
po = addarg(po, vbool(PENUMBRAS) ? "-ps 1" : "-ps 5"); |
740 |
|
op = addarg(op, "-dp 2048"); |
741 |
|
sprintf(op, " -ar %d", (int)(32*d)); |
742 |
|
op += strlen(op); |
743 |
+ |
sprintf(op, " -ms %.2g", asz/80.); |
744 |
+ |
op += strlen(op); |
745 |
|
break; |
746 |
|
case HIGH: |
747 |
|
po = addarg(po, vbool(PENUMBRAS) ? "-ps 1" : "-ps 3"); |
748 |
|
op = addarg(op, "-dp 4096"); |
749 |
|
sprintf(op, " -ar %d", (int)(64*d)); |
750 |
|
op += strlen(op); |
751 |
+ |
sprintf(op, " -ms %.2g", asz/160.); |
752 |
+ |
op += strlen(op); |
753 |
|
break; |
754 |
|
} |
755 |
|
po = addarg(po, "-pt .04"); |
767 |
|
overture = 0; |
768 |
|
switch (vscale(VARIABILITY)) { |
769 |
|
case LOW: |
770 |
< |
op = addarg(op, "-aa .15 -ad 256 -as 0"); |
770 |
> |
op = addarg(op, "-aw 128 -aa .15 -ad 256 -as 0"); |
771 |
|
break; |
772 |
|
case MEDIUM: |
773 |
< |
op = addarg(op, "-aa .125 -ad 512 -as 256"); |
773 |
> |
op = addarg(op, "-aw 1024 -aa .125 -ad 512 -as 256"); |
774 |
|
break; |
775 |
|
case HIGH: |
776 |
|
op = addarg(op, "-aa .08 -ad 1024 -as 512"); |
796 |
|
return; |
797 |
|
if (vdef(OPTFILE)) { |
798 |
|
for (cp = ro; cp[1]; cp++) |
799 |
< |
if (isspace(cp[1]) && cp[2] == '-' && isalpha(cp[3])) |
799 |
> |
if (isspace(cp[1]) && (cp[2] == '@' || |
800 |
> |
(cp[2] == '-' && isalpha(cp[3])))) |
801 |
|
*cp = '\n'; |
802 |
|
else |
803 |
|
*cp = cp[1]; |
995 |
|
} |
996 |
|
/* view number? */ |
997 |
|
if (isint(viewselect)) |
998 |
< |
return(specview(nvalue(vv+VIEW, atoi(viewselect)-1))); |
998 |
> |
return(specview(nvalue(VIEW, atoi(viewselect)-1))); |
999 |
|
/* check list */ |
1000 |
< |
while ((mv = nvalue(vv+VIEW, n++)) != NULL) |
1000 |
> |
while ((mv = nvalue(VIEW, n++)) != NULL) |
1001 |
|
if (matchword(viewselect, mv)) |
1002 |
|
return(specview(mv)); |
1003 |
|
return(specview(viewselect)); /* standard view? */ |
1004 |
|
} |
1005 |
< |
mv = nvalue(vv+VIEW, n); /* use view n */ |
1005 |
> |
mv = nvalue(VIEW, n); /* use view n */ |
1006 |
|
if (vn != NULL & mv != NULL) { |
1007 |
|
register char *mv2 = mv; |
1008 |
|
if (*mv2 != '-') |
1098 |
|
char *opts, *po; |
1099 |
|
{ |
1100 |
|
char combuf[1024]; |
1101 |
< |
char rawfile[MAXPATH], picfile[MAXPATH], rep[MAXPATH+16], res[32]; |
1101 |
> |
char rawfile[MAXPATH], picfile[MAXPATH]; |
1102 |
> |
char zopt[MAXPATH+4], rep[MAXPATH+16], res[32]; |
1103 |
|
char pfopts[128]; |
1104 |
|
char vs[32], *vw; |
1105 |
|
int vn, mult; |
1152 |
|
if (!vs[0]) |
1153 |
|
sprintf(vs, "%d", vn); |
1154 |
|
sprintf(picfile, "%s_%s.pic", vval(PICTURE), vs); |
1155 |
+ |
if (vdef(ZFILE)) |
1156 |
+ |
sprintf(zopt, " -z %s_%s.zbf", vval(ZFILE), vs); |
1157 |
+ |
else |
1158 |
+ |
zopt[0] = '\0'; |
1159 |
|
/* check date on picture */ |
1160 |
|
pfdt = fdate(picfile); |
1161 |
|
if (pfdt >= oct1date) |
1162 |
|
continue; |
1163 |
|
/* get raw file name */ |
1164 |
< |
sprintf(rawfile, "%s_%s.raw", vval(PICTURE), vs); |
1164 |
> |
sprintf(rawfile, "%s_%s.unf", |
1165 |
> |
vdef(RAWFILE) ? vval(RAWFILE) : vval(PICTURE), vs); |
1166 |
|
rfdt = fdate(rawfile); |
1167 |
|
if (touchonly) { /* update times only */ |
1168 |
|
if (rfdt) { |
1174 |
|
} |
1175 |
|
/* build rpict command */ |
1176 |
|
if (rfdt >= oct1date) /* recover */ |
1177 |
< |
sprintf(combuf, "rpict%s%s%s -ro %s %s", |
1178 |
< |
rep, po, opts, rawfile, oct1name); |
1177 |
> |
sprintf(combuf, "rpict%s%s%s%s -ro %s %s", |
1178 |
> |
rep, po, opts, zopt, rawfile, oct1name); |
1179 |
|
else { |
1180 |
|
if (overture) { /* run overture calculation */ |
1181 |
|
sprintf(combuf, |
1192 |
|
rmfile(overfile); |
1193 |
|
#endif |
1194 |
|
} |
1195 |
< |
sprintf(combuf, "rpict%s %s %s%s%s %s > %s", |
1196 |
< |
rep, vw, res, po, opts, |
1197 |
< |
oct1name, rawfile); |
1195 |
> |
sprintf(combuf, "rpict%s %s %s%s%s%s %s > %s", |
1196 |
> |
rep, vw, res, po, opts, zopt, |
1197 |
> |
oct1name, rawfile); |
1198 |
|
} |
1199 |
|
if (runcom(combuf)) { /* run rpict */ |
1200 |
|
fprintf(stderr, "%s: error rendering view %s\n", |
1201 |
|
progname, vs); |
1202 |
|
exit(1); |
1203 |
|
} |
1204 |
+ |
if (!vdef(RAWFILE) || strcmp(vval(RAWFILE),vval(PICTURE))) { |
1205 |
|
/* build pfilt command */ |
1206 |
< |
if (mult > 1) |
1207 |
< |
sprintf(combuf, "pfilt%s -x /%d -y /%d %s > %s", |
1206 |
> |
if (mult > 1) |
1207 |
> |
sprintf(combuf, "pfilt%s -x /%d -y /%d %s > %s", |
1208 |
|
pfopts, mult, mult, rawfile, picfile); |
1209 |
< |
else |
1210 |
< |
sprintf(combuf, "pfilt%s %s > %s", pfopts, |
1211 |
< |
rawfile, picfile); |
1212 |
< |
if (runcom(combuf)) { /* run pfilt */ |
1213 |
< |
fprintf(stderr, |
1214 |
< |
"%s: error filtering view %s\n\t%s removed\n", |
1215 |
< |
progname, vs, picfile); |
1216 |
< |
unlink(picfile); |
1217 |
< |
exit(1); |
1209 |
> |
else |
1210 |
> |
sprintf(combuf, "pfilt%s %s > %s", pfopts, |
1211 |
> |
rawfile, picfile); |
1212 |
> |
if (runcom(combuf)) { /* run pfilt */ |
1213 |
> |
fprintf(stderr, |
1214 |
> |
"%s: error filtering view %s\n\t%s removed\n", |
1215 |
> |
progname, vs, picfile); |
1216 |
> |
unlink(picfile); |
1217 |
> |
exit(1); |
1218 |
> |
} |
1219 |
|
} |
1220 |
|
/* remove/rename raw file */ |
1221 |
< |
if (vbool(RAWSAVE)) { |
1222 |
< |
sprintf(combuf, "%s_%s.rwp", vval(PICTURE), vs); |
1221 |
> |
if (vdef(RAWFILE)) { |
1222 |
> |
sprintf(combuf, "%s_%s.pic", vval(RAWFILE), vs); |
1223 |
|
mvfile(rawfile, combuf); |
1224 |
|
} else |
1225 |
|
rmfile(rawfile); |