27 |
|
#define OBJECT 0 /* object files */ |
28 |
|
#define SCENE 1 /* scene files */ |
29 |
|
#define MATERIAL 2 /* material files */ |
30 |
< |
#define RENDER 3 /* rendering options */ |
31 |
< |
#define OCONV 4 /* oconv options */ |
32 |
< |
#define PFILT 5 /* pfilt options */ |
33 |
< |
#define VIEW 6 /* view(s) for picture(s) */ |
34 |
< |
#define ZONE 7 /* simulation zone */ |
35 |
< |
#define QUALITY 8 /* desired rendering quality */ |
36 |
< |
#define OCTREE 9 /* octree file name */ |
37 |
< |
#define PICTURE 10 /* picture file name */ |
38 |
< |
#define AMBFILE 11 /* ambient file name */ |
39 |
< |
#define OPTFILE 12 /* rendering options file */ |
40 |
< |
#define EXPOSURE 13 /* picture exposure setting */ |
41 |
< |
#define RESOLUTION 14 /* maximum picture resolution */ |
42 |
< |
#define UP 15 /* view up (X, Y or Z) */ |
43 |
< |
#define INDIRECT 16 /* indirection in lighting */ |
44 |
< |
#define DETAIL 17 /* level of scene detail */ |
45 |
< |
#define PENUMBRAS 18 /* shadow penumbras are desired */ |
46 |
< |
#define VARIABILITY 19 /* level of light variability */ |
47 |
< |
#define REPORT 20 /* report frequency and errfile */ |
30 |
> |
#define ILLUM 3 /* mkillum input files */ |
31 |
> |
#define MKILLUM 4 /* mkillum options */ |
32 |
> |
#define RENDER 5 /* rendering options */ |
33 |
> |
#define OCONV 6 /* oconv options */ |
34 |
> |
#define PFILT 7 /* pfilt options */ |
35 |
> |
#define VIEW 8 /* view(s) for picture(s) */ |
36 |
> |
#define ZONE 9 /* simulation zone */ |
37 |
> |
#define QUALITY 10 /* desired rendering quality */ |
38 |
> |
#define OCTREE 11 /* octree file name */ |
39 |
> |
#define PICTURE 12 /* picture file name */ |
40 |
> |
#define AMBFILE 13 /* ambient file name */ |
41 |
> |
#define OPTFILE 14 /* rendering options file */ |
42 |
> |
#define EXPOSURE 15 /* picture exposure setting */ |
43 |
> |
#define RESOLUTION 16 /* maximum picture resolution */ |
44 |
> |
#define UP 17 /* view up (X, Y or Z) */ |
45 |
> |
#define INDIRECT 18 /* indirection in lighting */ |
46 |
> |
#define DETAIL 19 /* level of scene detail */ |
47 |
> |
#define PENUMBRAS 20 /* shadow penumbras are desired */ |
48 |
> |
#define VARIABILITY 21 /* level of light variability */ |
49 |
> |
#define REPORT 22 /* report frequency and errfile */ |
50 |
|
/* total number of variables */ |
51 |
< |
#define NVARS 21 |
51 |
> |
#define NVARS 23 |
52 |
|
|
53 |
|
VARIABLE vv[NVARS] = { /* variable-value pairs */ |
54 |
|
{"objects", 3, 0, NULL, catvalues}, |
55 |
|
{"scene", 3, 0, NULL, catvalues}, |
56 |
|
{"materials", 3, 0, NULL, catvalues}, |
57 |
+ |
{"illum", 3, 0, NULL, catvalues}, |
58 |
+ |
{"mkillum", 3, 0, NULL, catvalues}, |
59 |
|
{"render", 3, 0, NULL, catvalues}, |
60 |
|
{"oconv", 3, 0, NULL, catvalues}, |
61 |
|
{"pfilt", 2, 0, NULL, catvalues}, |
105 |
|
char overfile[] = "/dev/null"; |
106 |
|
#endif |
107 |
|
|
108 |
< |
extern long fdate(), time(); |
108 |
> |
extern unsigned long fdate(), time(); |
109 |
|
|
110 |
< |
long scenedate; /* date of latest scene or object file */ |
111 |
< |
long octreedate; /* date of octree */ |
112 |
< |
long matdate; /* date of latest material file */ |
110 |
> |
unsigned long scenedate; /* date of latest scene or object file */ |
111 |
> |
unsigned long octreedate; /* date of octree */ |
112 |
> |
unsigned long matdate; /* date of latest material file */ |
113 |
> |
unsigned long illumdate; /* date of last illum file */ |
114 |
|
|
115 |
+ |
char *oct0name; /* name of pre-mkillum octree */ |
116 |
+ |
unsigned long oct0date; /* date of pre-mkillum octree */ |
117 |
+ |
char *oct1name; /* name of post-mkillum octree */ |
118 |
+ |
unsigned long oct1date; /* date of post-mkillum octree (>= matdate) */ |
119 |
+ |
|
120 |
|
int explicate = 0; /* explicate variables */ |
121 |
|
int silent = 0; /* do work silently */ |
122 |
|
int noaction = 0; /* don't do anything */ |
123 |
< |
int vwonly = 0; /* print view only */ |
123 |
> |
int sayview = 0; /* print view out */ |
124 |
|
char *rvdevice = NULL; /* rview output device */ |
125 |
|
char *viewselect = NULL; /* specific view only */ |
126 |
|
|
127 |
|
int overture = 0; /* overture calculation needed */ |
128 |
|
|
129 |
|
char *progname; /* global argv[0] */ |
130 |
+ |
char *rifname; /* global rad input file name */ |
131 |
|
|
132 |
|
char radname[MAXPATH]; /* root Radiance file name */ |
133 |
|
|
156 |
|
rvdevice = argv[++i]; |
157 |
|
break; |
158 |
|
case 'V': |
159 |
< |
vwonly++; |
160 |
< |
/* fall through */ |
159 |
> |
sayview++; |
160 |
> |
break; |
161 |
|
case 'v': |
162 |
|
viewselect = argv[++i]; |
163 |
|
break; |
166 |
|
} |
167 |
|
if (i >= argc) |
168 |
|
goto userr; |
169 |
+ |
rifname = argv[i]; |
170 |
|
/* assign Radiance root file name */ |
171 |
< |
rootname(radname, argv[i]); |
171 |
> |
rootname(radname, rifname); |
172 |
|
/* load variable values */ |
173 |
< |
load(argv[i]); |
173 |
> |
load(rifname); |
174 |
|
/* get any additional assignments */ |
175 |
|
for (i++; i < argc; i++) |
176 |
|
setvariable(argv[i]); |
183 |
|
/* print all values if requested */ |
184 |
|
if (explicate) |
185 |
|
printvals(); |
186 |
< |
/* print view and exit? */ |
175 |
< |
if (vwonly) |
176 |
< |
exit(printview()==0 ? 0 : 1); |
177 |
< |
/* build octree */ |
186 |
> |
/* build octree (and run mkillum) */ |
187 |
|
oconv(); |
188 |
|
/* check date on ambient file */ |
189 |
|
checkambfile(); |
197 |
|
exit(0); |
198 |
|
userr: |
199 |
|
fprintf(stderr, |
200 |
< |
"Usage: %s [-s][-n][-e][-v view][-o dev] rfile [VAR=value ..]\n", |
200 |
> |
"Usage: %s [-s][-n][-e][-V][-v view][-o dev] rfile [VAR=value ..]\n", |
201 |
|
progname); |
202 |
|
exit(1); |
203 |
|
} |
218 |
|
} |
219 |
|
|
220 |
|
|
221 |
+ |
#define NOCHAR 127 /* constant for character to delete */ |
222 |
+ |
|
223 |
+ |
|
224 |
|
load(rfname) /* load Radiance simulation file */ |
225 |
|
char *rfname; |
226 |
|
{ |
236 |
|
for (cp = buf; *cp; cp++) { |
237 |
|
switch (*cp) { |
238 |
|
case '\\': |
239 |
< |
case '\n': |
228 |
< |
*cp = ' '; |
239 |
> |
*cp++ = NOCHAR; |
240 |
|
continue; |
241 |
|
case '#': |
242 |
|
*cp = '\0'; |
256 |
|
register char *ass; |
257 |
|
{ |
258 |
|
char varname[32]; |
259 |
+ |
char varval[512]; |
260 |
+ |
int n; |
261 |
|
register char *cp; |
262 |
|
register VARIABLE *vp; |
263 |
|
register int i; |
251 |
– |
int n; |
264 |
|
|
265 |
|
while (isspace(*ass)) /* skip leading space */ |
266 |
|
ass++; |
274 |
|
/* trim value */ |
275 |
|
while (isspace(*ass) || *ass == '=') |
276 |
|
ass++; |
277 |
< |
cp = ass + strlen(ass); |
278 |
< |
do |
279 |
< |
*cp-- = '\0'; |
268 |
< |
while (cp >= ass && isspace(*cp)); |
269 |
< |
n = cp - ass + 1; |
277 |
> |
for (n = strlen(ass); n > 0; n--) |
278 |
> |
if (!isspace(ass[n-1])) |
279 |
> |
break; |
280 |
|
if (!n) { |
281 |
|
fprintf(stderr, "%s: warning - missing value for variable '%s'\n", |
282 |
|
progname, varname); |
301 |
|
vp->value = malloc(n+1); |
302 |
|
if (vp->value == NULL) |
303 |
|
syserr(progname); |
304 |
< |
strcpy(vp->value+i, ass); |
304 |
> |
cp = vp->value+i; /* copy value, squeezing spaces */ |
305 |
> |
*cp = *ass; |
306 |
> |
for (i = 1; i <= n; i++) { |
307 |
> |
if (ass[i] == NOCHAR) |
308 |
> |
continue; |
309 |
> |
if (isspace(*cp)) |
310 |
> |
while (isspace(ass[i])) |
311 |
> |
i++; |
312 |
> |
*++cp = ass[i]; |
313 |
> |
} |
314 |
> |
if (isspace(*cp)) /* remove trailing space */ |
315 |
> |
*cp = '\0'; |
316 |
|
vp->nass++; |
317 |
|
} |
318 |
|
|
402 |
|
} |
403 |
|
|
404 |
|
|
405 |
< |
long |
405 |
> |
unsigned long |
406 |
|
checklast(fnames) /* check files and find most recent */ |
407 |
|
register char *fnames; |
408 |
|
{ |
409 |
|
char thisfile[MAXPATH]; |
410 |
< |
long thisdate, lastdate = -1; |
410 |
> |
unsigned long thisdate, lastdate = 0; |
411 |
|
register char *cp; |
412 |
|
|
413 |
+ |
if (fnames == NULL) |
414 |
+ |
return(0); |
415 |
|
while (*fnames) { |
416 |
|
while (isspace(*fnames)) fnames++; |
417 |
|
cp = thisfile; |
418 |
|
while (*fnames && !isspace(*fnames)) |
419 |
|
*cp++ = *fnames++; |
420 |
|
*cp = '\0'; |
421 |
< |
if ((thisdate = fdate(thisfile)) < 0) |
421 |
> |
if (!(thisdate = fdate(thisfile))) |
422 |
|
syserr(thisfile); |
423 |
|
if (thisdate > lastdate) |
424 |
|
lastdate = thisdate; |
427 |
|
} |
428 |
|
|
429 |
|
|
430 |
+ |
char * |
431 |
+ |
newfname(orig, pred) /* create modified file name */ |
432 |
+ |
char *orig; |
433 |
+ |
int pred; |
434 |
+ |
{ |
435 |
+ |
extern char *rindex(); |
436 |
+ |
register char *cp; |
437 |
+ |
register int n; |
438 |
+ |
int suffix; |
439 |
+ |
|
440 |
+ |
suffix = n = strlen(orig); /* find start of suffix */ |
441 |
+ |
if ((cp = rindex(orig, '.')) != NULL) |
442 |
+ |
suffix = cp - orig; |
443 |
+ |
if ((cp = bmalloc(n+2)) == NULL) |
444 |
+ |
syserr(progname); |
445 |
+ |
strncpy(cp, orig, suffix); |
446 |
+ |
cp[suffix] = pred; /* root name + pred + suffix */ |
447 |
+ |
strcpy(cp+suffix+1, orig+suffix); |
448 |
+ |
return(cp); |
449 |
+ |
} |
450 |
+ |
|
451 |
+ |
|
452 |
|
checkfiles() /* check for existence and modified times */ |
453 |
|
{ |
454 |
< |
char *cp; |
410 |
< |
long objdate; |
454 |
> |
unsigned long objdate; |
455 |
|
|
456 |
|
if (!vdef(OCTREE)) { |
457 |
< |
if ((cp = bmalloc(strlen(radname)+5)) == NULL) |
457 |
> |
if ((vval(OCTREE) = bmalloc(strlen(radname)+5)) == NULL) |
458 |
|
syserr(progname); |
459 |
< |
sprintf(cp, "%s.oct", radname); |
416 |
< |
vval(OCTREE) = cp; |
459 |
> |
sprintf(vval(OCTREE), "%s.oct", radname); |
460 |
|
vdef(OCTREE)++; |
461 |
|
} |
462 |
|
octreedate = fdate(vval(OCTREE)); |
463 |
< |
scenedate = -1; |
464 |
< |
if (vdef(SCENE)) { |
465 |
< |
scenedate = checklast(vval(SCENE)); |
466 |
< |
if (vdef(OBJECT)) { |
467 |
< |
objdate = checklast(vval(OBJECT)); |
468 |
< |
if (objdate > scenedate) |
469 |
< |
scenedate = objdate; |
470 |
< |
} |
471 |
< |
} |
472 |
< |
if (octreedate < 0 & scenedate < 0) { |
473 |
< |
fprintf(stderr, "%s: need '%s' or '%s'\n", progname, |
474 |
< |
vnam(OCTREE), vnam(SCENE)); |
463 |
> |
if (vdef(ILLUM)) { /* illum requires secondary octrees */ |
464 |
> |
oct0name = newfname(vval(OCTREE), '0'); |
465 |
> |
oct1name = newfname(vval(OCTREE), '1'); |
466 |
> |
oct0date = fdate(oct0name); |
467 |
> |
oct1date = fdate(oct1name); |
468 |
> |
} else |
469 |
> |
oct0name = oct1name = vval(OCTREE); |
470 |
> |
if ((scenedate = checklast(vval(SCENE))) && |
471 |
> |
(objdate = checklast(vval(OBJECT))) > scenedate) |
472 |
> |
scenedate = objdate; |
473 |
> |
illumdate = checklast(vval(ILLUM)); |
474 |
> |
if (!octreedate & !scenedate & !illumdate) { |
475 |
> |
fprintf(stderr, "%s: need '%s' or '%s' or '%s'\n", progname, |
476 |
> |
vnam(OCTREE), vnam(SCENE), vnam(ILLUM)); |
477 |
|
exit(1); |
478 |
|
} |
479 |
< |
matdate = -1; |
435 |
< |
if (vdef(MATERIAL)) |
436 |
< |
matdate = checklast(vval(MATERIAL)); |
479 |
> |
matdate = checklast(vval(MATERIAL)); |
480 |
|
} |
481 |
|
|
482 |
|
|
485 |
|
{ |
486 |
|
extern FILE *popen(); |
487 |
|
static double oorg[3], osiz = 0.; |
488 |
< |
char buf[MAXPATH+16]; |
488 |
> |
double min[3], max[3]; |
489 |
> |
char buf[512]; |
490 |
|
FILE *fp; |
491 |
+ |
register int i; |
492 |
|
|
493 |
< |
if (osiz <= FTINY) { |
494 |
< |
oconv(); /* does nothing if done already */ |
495 |
< |
sprintf(buf, "getinfo -d < %s", vval(OCTREE)); |
496 |
< |
if ((fp = popen(buf, "r")) == NULL) |
497 |
< |
syserr("getinfo"); |
498 |
< |
if (fscanf(fp, "%lf %lf %lf %lf", &oorg[0], &oorg[1], |
499 |
< |
&oorg[2], &osiz) != 4) { |
500 |
< |
fprintf(stderr, |
493 |
> |
if (osiz <= FTINY) |
494 |
> |
if (noaction && fdate(oct1name) < |
495 |
> |
(scenedate>illumdate?scenedate:illumdate)) { |
496 |
> |
/* run getbbox */ |
497 |
> |
sprintf(buf, "getbbox -w -h %s", |
498 |
> |
vdef(SCENE) ? vval(SCENE) : vval(ILLUM)); |
499 |
> |
if ((fp = popen(buf, "r")) == NULL) |
500 |
> |
syserr("getbbox"); |
501 |
> |
if (fscanf(fp, "%lf %lf %lf %lf %lf %lf", |
502 |
> |
&min[0], &max[0], &min[1], &max[1], |
503 |
> |
&min[2], &max[2]) != 6) { |
504 |
> |
fprintf(stderr, |
505 |
> |
"%s: error reading bounding box from getbbox\n", |
506 |
> |
progname); |
507 |
> |
exit(1); |
508 |
> |
} |
509 |
> |
for (i = 0; i < 3; i++) |
510 |
> |
if (max[i] - min[i] > osiz) |
511 |
> |
osiz = max[i] - min[i]; |
512 |
> |
for (i = 0; i < 3; i++) |
513 |
> |
oorg[i] = (max[i]+min[i]-osiz)*.5; |
514 |
> |
pclose(fp); |
515 |
> |
} else { /* from octree */ |
516 |
> |
oconv(); /* does nothing if done already */ |
517 |
> |
sprintf(buf, "getinfo -d < %s", oct1name); |
518 |
> |
if ((fp = popen(buf, "r")) == NULL) |
519 |
> |
syserr("getinfo"); |
520 |
> |
if (fscanf(fp, "%lf %lf %lf %lf", &oorg[0], &oorg[1], |
521 |
> |
&oorg[2], &osiz) != 4) { |
522 |
> |
fprintf(stderr, |
523 |
|
"%s: error reading bounding cube from getinfo\n", |
524 |
< |
progname); |
525 |
< |
exit(1); |
524 |
> |
progname); |
525 |
> |
exit(1); |
526 |
> |
} |
527 |
> |
pclose(fp); |
528 |
|
} |
460 |
– |
pclose(fp); |
461 |
– |
} |
529 |
|
org[0] = oorg[0]; org[1] = oorg[1]; org[2] = oorg[2]; *sizp = osiz; |
530 |
|
} |
531 |
|
|
588 |
|
} |
589 |
|
|
590 |
|
|
591 |
< |
oconv() /* run oconv if necessary */ |
591 |
> |
oconv() /* run oconv and mkillum if necessary */ |
592 |
|
{ |
593 |
< |
char combuf[512], ocopts[64]; |
593 |
> |
static char illumtmp[] = "ilXXXXXX"; |
594 |
> |
char combuf[512], ocopts[64], mkopts[64]; |
595 |
|
|
596 |
< |
if (octreedate >= scenedate) /* check dates */ |
597 |
< |
return; |
598 |
< |
/* build command */ |
599 |
< |
oconvopts(ocopts); |
600 |
< |
if (vdef(MATERIAL)) |
533 |
< |
sprintf(combuf, "oconv%s %s %s > %s", ocopts, |
596 |
> |
oconvopts(ocopts); /* get options */ |
597 |
> |
if (octreedate < scenedate) { /* check date on original octree */ |
598 |
> |
/* build command */ |
599 |
> |
if (vdef(MATERIAL)) |
600 |
> |
sprintf(combuf, "oconv%s %s %s > %s", ocopts, |
601 |
|
vval(MATERIAL), vval(SCENE), vval(OCTREE)); |
602 |
+ |
else |
603 |
+ |
sprintf(combuf, "oconv%s %s > %s", ocopts, |
604 |
+ |
vval(SCENE), vval(OCTREE)); |
605 |
+ |
|
606 |
+ |
if (runcom(combuf)) { /* run it */ |
607 |
+ |
fprintf(stderr, |
608 |
+ |
"%s: error generating octree\n\t%s removed\n", |
609 |
+ |
progname, vval(OCTREE)); |
610 |
+ |
unlink(vval(OCTREE)); |
611 |
+ |
exit(1); |
612 |
+ |
} |
613 |
+ |
octreedate = time(0); |
614 |
+ |
} |
615 |
+ |
if (oct1name == vval(OCTREE)) /* no mkillum? */ |
616 |
+ |
oct1date = octreedate > matdate ? octreedate : matdate; |
617 |
+ |
if (oct1date >= octreedate & oct1date >= matdate |
618 |
+ |
& oct1date >= illumdate) /* all done */ |
619 |
+ |
return; |
620 |
+ |
/* make octree0 */ |
621 |
+ |
if (oct0date < scenedate | oct0date < illumdate) { |
622 |
+ |
/* build command */ |
623 |
+ |
if (octreedate) |
624 |
+ |
sprintf(combuf, "oconv%s -i %s %s > %s", ocopts, |
625 |
+ |
vval(OCTREE), vval(ILLUM), oct0name); |
626 |
+ |
else if (vdef(MATERIAL)) |
627 |
+ |
sprintf(combuf, "oconv%s %s %s > %s", ocopts, |
628 |
+ |
vval(MATERIAL), vval(ILLUM), oct0name); |
629 |
+ |
else |
630 |
+ |
sprintf(combuf, "oconv%s %s > %s", ocopts, |
631 |
+ |
vval(ILLUM), oct0name); |
632 |
+ |
if (runcom(combuf)) { /* run it */ |
633 |
+ |
fprintf(stderr, |
634 |
+ |
"%s: error generating octree\n\t%s removed\n", |
635 |
+ |
progname, oct0name); |
636 |
+ |
unlink(oct0name); |
637 |
+ |
exit(1); |
638 |
+ |
} |
639 |
+ |
oct0date = time(0); |
640 |
+ |
} |
641 |
+ |
mkillumopts(mkopts); /* build mkillum command */ |
642 |
+ |
mktemp(illumtmp); |
643 |
+ |
sprintf(combuf, "mkillum%s %s \"<\" %s > %s", mkopts, |
644 |
+ |
oct0name, vval(ILLUM), illumtmp); |
645 |
+ |
if (runcom(combuf)) { /* run it */ |
646 |
+ |
fprintf(stderr, "%s: error running mkillum\n", progname); |
647 |
+ |
unlink(illumtmp); |
648 |
+ |
exit(1); |
649 |
+ |
} |
650 |
+ |
/* make octree1 (frozen) */ |
651 |
+ |
if (octreedate) |
652 |
+ |
sprintf(combuf, "oconv%s -f -i %s %s > %s", ocopts, |
653 |
+ |
vval(OCTREE), illumtmp, oct1name); |
654 |
+ |
else if (vdef(MATERIAL)) |
655 |
+ |
sprintf(combuf, "oconv%s -f %s %s > %s", ocopts, |
656 |
+ |
vval(MATERIAL), illumtmp, oct1name); |
657 |
|
else |
658 |
< |
sprintf(combuf, "oconv%s %s > %s", ocopts, |
659 |
< |
vval(SCENE), vval(OCTREE)); |
538 |
< |
|
658 |
> |
sprintf(combuf, "oconv%s -f %s > %s", ocopts, |
659 |
> |
illumtmp, oct1name); |
660 |
|
if (runcom(combuf)) { /* run it */ |
661 |
< |
fprintf(stderr, "%s: error generating octree\n\t%s removed\n", |
662 |
< |
progname, vval(OCTREE)); |
663 |
< |
unlink(vval(OCTREE)); |
661 |
> |
fprintf(stderr, |
662 |
> |
"%s: error generating octree\n\t%s removed\n", |
663 |
> |
progname, oct1name); |
664 |
> |
unlink(oct1name); |
665 |
|
exit(1); |
666 |
|
} |
667 |
< |
octreedate = time(0); |
667 |
> |
oct1date = time(0); |
668 |
> |
rmfile(illumtmp); |
669 |
|
} |
670 |
|
|
671 |
|
|
691 |
|
} |
692 |
|
|
693 |
|
|
694 |
+ |
mkillumopts(mo) /* get mkillum options */ |
695 |
+ |
register char *mo; |
696 |
+ |
{ |
697 |
+ |
/* BEWARE: This may be called via setdefaults(), so no assumptions */ |
698 |
+ |
|
699 |
+ |
*mo = '\0'; |
700 |
+ |
if (vdef(MKILLUM)) |
701 |
+ |
addarg(mo, vval(MKILLUM)); |
702 |
+ |
} |
703 |
+ |
|
704 |
+ |
|
705 |
|
checkambfile() /* check date on ambient file */ |
706 |
|
{ |
707 |
< |
long afdate; |
707 |
> |
unsigned long afdate; |
708 |
|
|
709 |
|
if (!vdef(AMBFILE)) |
710 |
|
return; |
711 |
< |
if ((afdate = fdate(vval(AMBFILE))) < 0) |
711 |
> |
if (!(afdate = fdate(vval(AMBFILE)))) |
712 |
|
return; |
713 |
< |
if (octreedate > afdate | matdate > afdate) |
713 |
> |
if (oct1date > afdate) |
714 |
|
rmfile(vval(AMBFILE)); |
715 |
|
} |
716 |
|
|
747 |
|
d *= 3./(siz[0]+siz[1]+siz[2]); |
748 |
|
switch (vscale(DETAIL)) { |
749 |
|
case LOW: |
750 |
< |
op = addarg(op, "-ps 16 -dp 16"); |
750 |
> |
op = addarg(op, "-ps 16 -dp 64"); |
751 |
|
sprintf(op, " -ar %d", (int)(4*d)); |
752 |
|
op += strlen(op); |
753 |
|
break; |
754 |
|
case MEDIUM: |
755 |
< |
op = addarg(op, "-ps 8 -dp 32"); |
755 |
> |
op = addarg(op, "-ps 8 -dp 128"); |
756 |
|
sprintf(op, " -ar %d", (int)(8*d)); |
757 |
|
op += strlen(op); |
758 |
|
break; |
759 |
|
case HIGH: |
760 |
< |
op = addarg(op, "-ps 4 -dp 64"); |
760 |
> |
op = addarg(op, "-ps 4 -dp 256"); |
761 |
|
sprintf(op, " -ar %d", (int)(16*d)); |
762 |
|
op += strlen(op); |
763 |
|
break; |
809 |
|
switch (vscale(DETAIL)) { |
810 |
|
case LOW: |
811 |
|
op = addarg(op, vbool(PENUMBRAS) ? "-ps 4" : "-ps 8"); |
812 |
< |
op = addarg(op, "-dp 64"); |
812 |
> |
op = addarg(op, "-dp 256"); |
813 |
|
sprintf(op, " -ar %d", (int)(8*d)); |
814 |
|
op += strlen(op); |
815 |
|
break; |
816 |
|
case MEDIUM: |
817 |
|
op = addarg(op, vbool(PENUMBRAS) ? "-ps 3" : "-ps 6"); |
818 |
< |
op = addarg(op, "-dp 128"); |
818 |
> |
op = addarg(op, "-dp 512"); |
819 |
|
sprintf(op, " -ar %d", (int)(16*d)); |
820 |
|
op += strlen(op); |
821 |
|
break; |
822 |
|
case HIGH: |
823 |
|
op = addarg(op, vbool(PENUMBRAS) ? "-ps 2" : "-ps 4"); |
824 |
< |
op = addarg(op, "-dp 256"); |
824 |
> |
op = addarg(op, "-dp 1024"); |
825 |
|
sprintf(op, " -ar %d", (int)(32*d)); |
826 |
|
op += strlen(op); |
827 |
|
break; |
876 |
|
switch (vscale(DETAIL)) { |
877 |
|
case LOW: |
878 |
|
op = addarg(op, vbool(PENUMBRAS) ? "-ps 1" : "-ps 8"); |
879 |
< |
op = addarg(op, "-dp 256"); |
879 |
> |
op = addarg(op, "-dp 1024"); |
880 |
|
sprintf(op, " -ar %d", (int)(16*d)); |
881 |
|
op += strlen(op); |
882 |
|
break; |
883 |
|
case MEDIUM: |
884 |
|
op = addarg(op, vbool(PENUMBRAS) ? "-ps 1" : "-ps 5"); |
885 |
< |
op = addarg(op, "-dp 512"); |
885 |
> |
op = addarg(op, "-dp 2048"); |
886 |
|
sprintf(op, " -ar %d", (int)(32*d)); |
887 |
|
op += strlen(op); |
888 |
|
break; |
889 |
|
case HIGH: |
890 |
|
op = addarg(op, vbool(PENUMBRAS) ? "-ps 1" : "-ps 3"); |
891 |
< |
op = addarg(op, "-dp 1024"); |
891 |
> |
op = addarg(op, "-dp 4096"); |
892 |
|
sprintf(op, " -ar %d", (int)(64*d)); |
893 |
|
op += strlen(op); |
894 |
|
break; |
1095 |
|
cp += strlen(cp); |
1096 |
|
} |
1097 |
|
} |
1098 |
< |
strcpy(cp, vs); /* append any additional options */ |
1098 |
> |
if (cp == viewopts) /* append any additional options */ |
1099 |
> |
vs++; /* skip prefixed space if unneeded */ |
1100 |
> |
strcpy(cp, vs); |
1101 |
|
#ifdef MSDOS |
1102 |
|
if (strlen(viewopts) > 40) { |
1103 |
|
setenv("VIEW", viewopts); |
1149 |
|
} |
1150 |
|
|
1151 |
|
|
1152 |
< |
printview() /* print out selected view */ |
1152 |
> |
printview(vopts) /* print out selected view */ |
1153 |
> |
register char *vopts; |
1154 |
|
{ |
1155 |
< |
extern char *atos(); |
1155 |
> |
extern char *atos(), *getenv(); |
1156 |
|
char buf[256]; |
1157 |
|
FILE *fp; |
1158 |
< |
register char *vopts, *cp; |
1158 |
> |
register char *cp; |
1159 |
|
|
1023 |
– |
vopts = getview(0, NULL); |
1160 |
|
if (vopts == NULL) |
1161 |
|
return(-1); |
1162 |
|
fputs("VIEW=", stdout); |
1187 |
|
while (isspace(*vopts)) |
1188 |
|
vopts++; |
1189 |
|
putchar(' '); |
1190 |
< |
while (*vopts && !isspace(*vopts)) |
1191 |
< |
putchar(*vopts++); |
1190 |
> |
#ifdef MSDOS |
1191 |
> |
if (*vopts == '$') { /* expand env. var. */ |
1192 |
> |
if (!*atos(buf, sizeof(buf), vopts+1)) |
1193 |
> |
return(-1); |
1194 |
> |
if ((cp = getenv(buf)) == NULL) |
1195 |
> |
return(-1); |
1196 |
> |
fputs(cp, stdout); |
1197 |
> |
vopts = sskip(vopts); |
1198 |
> |
} else |
1199 |
> |
#endif |
1200 |
> |
while (*vopts && !isspace(*vopts)) |
1201 |
> |
putchar(*vopts++); |
1202 |
|
} |
1203 |
|
} while (*vopts++); |
1204 |
|
putchar('\n'); |
1209 |
|
rview(opts) /* run rview with first view */ |
1210 |
|
char *opts; |
1211 |
|
{ |
1212 |
+ |
char *vw; |
1213 |
|
char combuf[512]; |
1214 |
|
/* build command */ |
1215 |
< |
sprintf(combuf, "rview %s%s ", getview(0, NULL), opts); |
1215 |
> |
if ((vw = getview(0, NULL)) == NULL) |
1216 |
> |
return; |
1217 |
> |
if (sayview) |
1218 |
> |
printview(vw); |
1219 |
> |
sprintf(combuf, "rview %s%s -R %s ", vw, opts, rifname); |
1220 |
|
if (rvdevice != NULL) |
1221 |
|
sprintf(combuf+strlen(combuf), "-o %s ", rvdevice); |
1222 |
< |
strcat(combuf, vval(OCTREE)); |
1222 |
> |
strcat(combuf, oct1name); |
1223 |
|
if (runcom(combuf)) { /* run it */ |
1224 |
|
fprintf(stderr, "%s: error running rview\n", progname); |
1225 |
|
exit(1); |
1235 |
|
char pfopts[128]; |
1236 |
|
char vs[32], *vw; |
1237 |
|
int vn, mult; |
1087 |
– |
long lastdate; |
1238 |
|
/* get pfilt options */ |
1239 |
|
pfiltopts(pfopts); |
1240 |
|
/* get resolution, reporting */ |
1265 |
|
else |
1266 |
|
badvalue(REPORT); |
1267 |
|
} |
1118 |
– |
/* get update time */ |
1119 |
– |
lastdate = octreedate > matdate ? octreedate : matdate; |
1268 |
|
/* do each view */ |
1269 |
|
vn = 0; |
1270 |
|
while ((vw = getview(vn++, vs)) != NULL) { |
1271 |
+ |
if (sayview) |
1272 |
+ |
printview(vw); |
1273 |
|
if (!vs[0]) |
1274 |
|
sprintf(vs, "%d", vn); |
1275 |
|
sprintf(picfile, "%s_%s.pic", vval(PICTURE), vs); |
1276 |
|
/* check date on picture */ |
1277 |
< |
if (fdate(picfile) >= lastdate) |
1277 |
> |
if (fdate(picfile) >= oct1date) |
1278 |
|
continue; |
1279 |
|
/* build rpict command */ |
1280 |
|
sprintf(rawfile, "%s_%s.raw", vval(PICTURE), vs); |
1281 |
< |
if (fdate(rawfile) >= octreedate) /* recover */ |
1281 |
> |
if (fdate(rawfile) >= oct1date) /* recover */ |
1282 |
|
sprintf(combuf, "rpict%s%s -ro %s %s", |
1283 |
< |
rep, opts, rawfile, vval(OCTREE)); |
1283 |
> |
rep, opts, rawfile, oct1name); |
1284 |
|
else { |
1285 |
|
if (overture) { /* run overture calculation */ |
1286 |
|
sprintf(combuf, |
1287 |
|
"rpict%s %s%s -x 64 -y 64 -ps 1 %s > %s", |
1288 |
|
rep, vw, opts, |
1289 |
< |
vval(OCTREE), overfile); |
1289 |
> |
oct1name, overfile); |
1290 |
|
if (runcom(combuf)) { |
1291 |
|
fprintf(stderr, |
1292 |
|
"%s: error in overture for view %s\n", |
1299 |
|
} |
1300 |
|
sprintf(combuf, "rpict%s %s %s%s %s > %s", |
1301 |
|
rep, vw, res, opts, |
1302 |
< |
vval(OCTREE), rawfile); |
1302 |
> |
oct1name, rawfile); |
1303 |
|
} |
1304 |
|
if (runcom(combuf)) { /* run rpict */ |
1305 |
|
fprintf(stderr, "%s: error rendering view %s\n", |