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 RAWFILE 23 /* raw picture file root name */ |
42 |
+ |
#define ZFILE 24 /* distance file root name */ |
43 |
|
/* total number of variables */ |
44 |
< |
#define NVARS 23 |
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 |
+ |
{"RAWFILE", 3, 0, NULL, onevalue}, |
71 |
+ |
{"ZFILE", 2, 0, NULL, onevalue}, |
72 |
|
}; |
73 |
|
|
81 |
– |
VARIABLE *matchvar(); |
82 |
– |
char *nvalue(); |
83 |
– |
|
84 |
– |
#define UPPER(c) ((c)&~0x20) /* ASCII trick */ |
85 |
– |
|
86 |
– |
#define vnam(vc) (vv[vc].name) |
87 |
– |
#define vdef(vc) (vv[vc].nass) |
88 |
– |
#define vval(vc) (vv[vc].value) |
89 |
– |
#define vint(vc) atoi(vval(vc)) |
90 |
– |
#define vlet(vc) UPPER(vval(vc)[0]) |
91 |
– |
#define vscale vlet |
92 |
– |
#define vbool(vc) (vlet(vc)=='T') |
93 |
– |
|
94 |
– |
#define HIGH 'H' |
95 |
– |
#define MEDIUM 'M' |
96 |
– |
#define LOW 'L' |
97 |
– |
|
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 |
|
|
227 |
– |
#define NOCHAR 127 /* constant for character to delete */ |
228 |
– |
|
229 |
– |
|
230 |
– |
load(rfname) /* load Radiance simulation file */ |
231 |
– |
char *rfname; |
232 |
– |
{ |
233 |
– |
FILE *fp; |
234 |
– |
char buf[512]; |
235 |
– |
register char *cp; |
236 |
– |
|
237 |
– |
if (rfname == NULL) |
238 |
– |
fp = stdin; |
239 |
– |
else if ((fp = fopen(rfname, "r")) == NULL) |
240 |
– |
syserr(rfname); |
241 |
– |
while (fgetline(buf, sizeof(buf), fp) != NULL) { |
242 |
– |
for (cp = buf; *cp; cp++) { |
243 |
– |
switch (*cp) { |
244 |
– |
case '\\': |
245 |
– |
*cp++ = NOCHAR; |
246 |
– |
continue; |
247 |
– |
case '#': |
248 |
– |
*cp = '\0'; |
249 |
– |
break; |
250 |
– |
default: |
251 |
– |
continue; |
252 |
– |
} |
253 |
– |
break; |
254 |
– |
} |
255 |
– |
setvariable(buf); |
256 |
– |
} |
257 |
– |
fclose(fp); |
258 |
– |
} |
259 |
– |
|
260 |
– |
|
261 |
– |
setvariable(ass) /* assign variable according to string */ |
262 |
– |
register char *ass; |
263 |
– |
{ |
264 |
– |
char varname[32]; |
265 |
– |
int n; |
266 |
– |
register char *cp; |
267 |
– |
register VARIABLE *vp; |
268 |
– |
register int i; |
269 |
– |
|
270 |
– |
while (isspace(*ass)) /* skip leading space */ |
271 |
– |
ass++; |
272 |
– |
cp = varname; /* extract name */ |
273 |
– |
while (cp < varname+sizeof(varname)-1 |
274 |
– |
&& *ass && !isspace(*ass) && *ass != '=') |
275 |
– |
*cp++ = *ass++; |
276 |
– |
*cp = '\0'; |
277 |
– |
if (!varname[0]) |
278 |
– |
return; /* no variable name! */ |
279 |
– |
/* trim value */ |
280 |
– |
while (isspace(*ass) || *ass == '=') |
281 |
– |
ass++; |
282 |
– |
for (n = strlen(ass); n > 0; n--) |
283 |
– |
if (!isspace(ass[n-1])) |
284 |
– |
break; |
285 |
– |
if (!n && !nowarn) { |
286 |
– |
fprintf(stderr, "%s: warning - missing value for variable '%s'\n", |
287 |
– |
progname, varname); |
288 |
– |
return; |
289 |
– |
} |
290 |
– |
/* match variable from list */ |
291 |
– |
vp = matchvar(varname); |
292 |
– |
if (vp == NULL) { |
293 |
– |
fprintf(stderr, "%s: unknown variable '%s'\n", |
294 |
– |
progname, varname); |
295 |
– |
exit(1); |
296 |
– |
} |
297 |
– |
/* assign new value */ |
298 |
– |
if (i = vp->nass) { |
299 |
– |
cp = vp->value; |
300 |
– |
while (i--) |
301 |
– |
while (*cp++) |
302 |
– |
; |
303 |
– |
i = cp - vp->value; |
304 |
– |
vp->value = realloc(vp->value, i+n+1); |
305 |
– |
} else |
306 |
– |
vp->value = malloc(n+1); |
307 |
– |
if (vp->value == NULL) |
308 |
– |
syserr(progname); |
309 |
– |
cp = vp->value+i; /* copy value, squeezing spaces */ |
310 |
– |
*cp = *ass; |
311 |
– |
for (i = 1; i <= n; i++) { |
312 |
– |
if (ass[i] == NOCHAR) |
313 |
– |
continue; |
314 |
– |
if (isspace(*cp)) |
315 |
– |
while (isspace(ass[i])) |
316 |
– |
i++; |
317 |
– |
*++cp = ass[i]; |
318 |
– |
} |
319 |
– |
if (isspace(*cp)) /* remove trailing space */ |
320 |
– |
*cp = '\0'; |
321 |
– |
vp->nass++; |
322 |
– |
} |
323 |
– |
|
324 |
– |
|
325 |
– |
VARIABLE * |
326 |
– |
matchvar(nam) /* match a variable by its name */ |
327 |
– |
char *nam; |
328 |
– |
{ |
329 |
– |
int n = strlen(nam); |
330 |
– |
register int i; |
331 |
– |
|
332 |
– |
for (i = 0; i < NVARS; i++) |
333 |
– |
if (n >= vv[i].nick && !strncmp(nam, vv[i].name, n)) |
334 |
– |
return(vv+i); |
335 |
– |
return(NULL); |
336 |
– |
} |
337 |
– |
|
338 |
– |
|
339 |
– |
char * |
340 |
– |
nvalue(vp, n) /* return nth variable value */ |
341 |
– |
VARIABLE *vp; |
342 |
– |
register int n; |
343 |
– |
{ |
344 |
– |
register char *cp; |
345 |
– |
|
346 |
– |
if (vp == NULL | n < 0 | n >= vp->nass) |
347 |
– |
return(NULL); |
348 |
– |
cp = vp->value; |
349 |
– |
while (n--) |
350 |
– |
while (*cp++) |
351 |
– |
; |
352 |
– |
return(cp); |
353 |
– |
} |
354 |
– |
|
355 |
– |
|
356 |
– |
checkvalues() /* check assignments */ |
357 |
– |
{ |
358 |
– |
register int i; |
359 |
– |
|
360 |
– |
for (i = 0; i < NVARS; i++) |
361 |
– |
if (vv[i].fixval != NULL) |
362 |
– |
(*vv[i].fixval)(vv+i); |
363 |
– |
} |
364 |
– |
|
365 |
– |
|
366 |
– |
onevalue(vp) /* only one assignment for this variable */ |
367 |
– |
register VARIABLE *vp; |
368 |
– |
{ |
369 |
– |
if (vp->nass < 2) |
370 |
– |
return; |
371 |
– |
if (!nowarn) |
372 |
– |
fprintf(stderr, |
373 |
– |
"%s: warning - multiple assignment of variable '%s'\n", |
374 |
– |
progname, vp->name); |
375 |
– |
do |
376 |
– |
vp->value += strlen(vp->value)+1; |
377 |
– |
while (--vp->nass > 1); |
378 |
– |
} |
379 |
– |
|
380 |
– |
|
381 |
– |
catvalues(vp) /* concatenate variable values */ |
382 |
– |
register VARIABLE *vp; |
383 |
– |
{ |
384 |
– |
register char *cp; |
385 |
– |
|
386 |
– |
if (vp->nass < 2) |
387 |
– |
return; |
388 |
– |
for (cp = vp->value; vp->nass > 1; vp->nass--) { |
389 |
– |
while (*cp) |
390 |
– |
cp++; |
391 |
– |
*cp++ = ' '; |
392 |
– |
} |
393 |
– |
} |
394 |
– |
|
395 |
– |
|
396 |
– |
int |
397 |
– |
badmatch(tv, cv) /* case insensitive truncated comparison */ |
398 |
– |
register char *tv, *cv; |
399 |
– |
{ |
400 |
– |
if (!*tv) return(1); /* null string cannot match */ |
401 |
– |
do |
402 |
– |
if (UPPER(*tv) != *cv++) |
403 |
– |
return(1); |
404 |
– |
while (*++tv); |
405 |
– |
return(0); /* OK */ |
406 |
– |
} |
407 |
– |
|
408 |
– |
|
409 |
– |
boolvalue(vp) /* check boolean for legal values */ |
410 |
– |
register VARIABLE *vp; |
411 |
– |
{ |
412 |
– |
if (!vp->nass) return; |
413 |
– |
onevalue(vp); |
414 |
– |
switch (UPPER(vp->value[0])) { |
415 |
– |
case 'T': |
416 |
– |
if (badmatch(vp->value, "TRUE")) break; |
417 |
– |
return; |
418 |
– |
case 'F': |
419 |
– |
if (badmatch(vp->value, "FALSE")) break; |
420 |
– |
return; |
421 |
– |
} |
422 |
– |
fprintf(stderr, "%s: illegal value for boolean variable '%s'\n", |
423 |
– |
progname, vp->name); |
424 |
– |
exit(1); |
425 |
– |
} |
426 |
– |
|
427 |
– |
|
428 |
– |
qualvalue(vp) /* check qualitative var. for legal values */ |
429 |
– |
register VARIABLE *vp; |
430 |
– |
{ |
431 |
– |
if (!vp->nass) return; |
432 |
– |
onevalue(vp); |
433 |
– |
switch (UPPER(vp->value[0])) { |
434 |
– |
case 'L': |
435 |
– |
if (badmatch(vp->value, "LOW")) break; |
436 |
– |
return; |
437 |
– |
case 'M': |
438 |
– |
if (badmatch(vp->value, "MEDIUM")) break; |
439 |
– |
return; |
440 |
– |
case 'H': |
441 |
– |
if (badmatch(vp->value, "HIGH")) break; |
442 |
– |
return; |
443 |
– |
} |
444 |
– |
fprintf(stderr, "%s: illegal value for qualitative variable '%s'\n", |
445 |
– |
progname, vp->name); |
446 |
– |
exit(1); |
447 |
– |
} |
448 |
– |
|
449 |
– |
|
450 |
– |
intvalue(vp) /* check integer variable for legal values */ |
451 |
– |
register VARIABLE *vp; |
452 |
– |
{ |
453 |
– |
if (!vp->nass) return; |
454 |
– |
onevalue(vp); |
455 |
– |
if (isint(vp->value)) return; |
456 |
– |
fprintf(stderr, "%s: illegal value for integer variable '%s'\n", |
457 |
– |
progname, vp->name); |
458 |
– |
exit(1); |
459 |
– |
} |
460 |
– |
|
461 |
– |
|
462 |
– |
fltvalue(vp) /* check float variable for legal values */ |
463 |
– |
register VARIABLE *vp; |
464 |
– |
{ |
465 |
– |
if (!vp->nass) return; |
466 |
– |
onevalue(vp); |
467 |
– |
if (isflt(vp->value)) return; |
468 |
– |
fprintf(stderr, "%s: illegal value for real variable '%s'\n", |
469 |
– |
progname, vp->name); |
470 |
– |
exit(1); |
471 |
– |
} |
472 |
– |
|
473 |
– |
|
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 |
|
|
379 |
|
} |
380 |
|
|
381 |
|
|
653 |
– |
printvals() /* print variable values */ |
654 |
– |
{ |
655 |
– |
int i, j, clipline; |
656 |
– |
register char *cp; |
657 |
– |
register int k; |
658 |
– |
|
659 |
– |
for (i = 0; i < NVARS; i++) /* print each variable */ |
660 |
– |
for (j = 0; j < vdef(i); j++) { /* print each assignment */ |
661 |
– |
fputs(vnam(i), stdout); |
662 |
– |
fputs("= ", stdout); |
663 |
– |
k = clipline = ( vv[i].fixval == catvalues ? 64 : 320 ) |
664 |
– |
- strlen(vnam(i)) ; |
665 |
– |
cp = nvalue(vv+i, j); |
666 |
– |
while (*cp) { |
667 |
– |
putchar(*cp++); |
668 |
– |
if (--k <= 0) { /* line too long */ |
669 |
– |
while (*cp && !isspace(*cp)) |
670 |
– |
putchar(*cp++); /* finish this word */ |
671 |
– |
if (*cp) { /* start new line */ |
672 |
– |
putchar('\n'); |
673 |
– |
fputs(vnam(i), stdout); |
674 |
– |
putchar('='); |
675 |
– |
k = clipline; |
676 |
– |
} |
677 |
– |
} |
678 |
– |
} |
679 |
– |
putchar('\n'); |
680 |
– |
} |
681 |
– |
fflush(stdout); |
682 |
– |
} |
683 |
– |
|
684 |
– |
|
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"); |
756 |
|
if (vbool(PENUMBRAS)) |
757 |
< |
op = addarg(op, "-ds .1 -dj .7"); |
757 |
> |
op = addarg(op, "-ds .1 -dj .65"); |
758 |
|
else |
759 |
|
op = addarg(op, "-ds .2"); |
760 |
|
op = addarg(op, "-dt .05 -dc .75 -dr 3 -sj 1 -st .01"); |
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]; |
892 |
|
zpos = -1; vs++; |
893 |
|
} |
894 |
|
viewtype = 'v'; |
895 |
< |
if (*vs == 'v' | *vs == 'l' | *vs == 'a' | *vs == 'h') |
895 |
> |
if (*vs == 'v' | *vs == 'l' | *vs == 'a' | *vs == 'h' | *vs == 'c') |
896 |
|
viewtype = *vs++; |
897 |
|
cp = viewopts; |
898 |
|
if ((!*vs || isspace(*vs)) && (xpos|ypos|zpos)) { /* got one! */ |
947 |
|
case 'h': |
948 |
|
cp = addarg(cp, "-vh 180 -vv 180"); |
949 |
|
break; |
950 |
+ |
case 'c': |
951 |
+ |
cp = addarg(cp, "-vh 180 -vv 90"); |
952 |
+ |
break; |
953 |
|
} |
954 |
|
} else { |
955 |
|
while (!isspace(*vs)) /* else skip id */ |
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 raw file */ |
1221 |
< |
rmfile(rawfile); |
1220 |
> |
/* remove/rename raw file */ |
1221 |
> |
if (vdef(RAWFILE)) { |
1222 |
> |
sprintf(combuf, "%s_%s.pic", vval(RAWFILE), vs); |
1223 |
> |
mvfile(rawfile, combuf); |
1224 |
> |
} else |
1225 |
> |
rmfile(rawfile); |
1226 |
|
} |
1227 |
|
} |
1228 |
|
|
1267 |
|
if (noaction) |
1268 |
|
return(0); |
1269 |
|
return(unlink(fn)); |
1270 |
+ |
} |
1271 |
+ |
|
1272 |
+ |
|
1273 |
+ |
mvfile(fold, fnew) /* move a file */ |
1274 |
+ |
char *fold, *fnew; |
1275 |
+ |
{ |
1276 |
+ |
if (!silent) |
1277 |
+ |
#ifdef MSDOS |
1278 |
+ |
printf("\trename %s %s\n", fold, fnew); |
1279 |
+ |
#else |
1280 |
+ |
printf("\tmv %s %s\n", fold, fnew); |
1281 |
+ |
#endif |
1282 |
+ |
if (noaction) |
1283 |
+ |
return(0); |
1284 |
+ |
return(rename(fold, fnew)); |
1285 |
|
} |
1286 |
|
|
1287 |
|
|