| 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"; |
| 38 |
|
#define ZONE 9 /* simulation zone */ |
| 39 |
|
#define QUALITY 10 /* desired rendering quality */ |
| 40 |
|
#define OCTREE 11 /* octree file name */ |
| 41 |
< |
#define PICTURE 12 /* picture file name */ |
| 41 |
> |
#define PICTURE 12 /* picture file root name */ |
| 42 |
|
#define AMBFILE 13 /* ambient file name */ |
| 43 |
|
#define OPTFILE 14 /* rendering options file */ |
| 44 |
|
#define EXPOSURE 15 /* picture exposure setting */ |
| 49 |
|
#define PENUMBRAS 20 /* shadow penumbras are desired */ |
| 50 |
|
#define VARIABILITY 21 /* level of light variability */ |
| 51 |
|
#define REPORT 22 /* report frequency and errfile */ |
| 52 |
+ |
#define RAWFILE 23 /* raw picture file root name */ |
| 53 |
+ |
#define ZFILE 24 /* distance file root name */ |
| 54 |
|
/* total number of variables */ |
| 55 |
< |
#define NVARS 23 |
| 55 |
> |
#define NVARS 25 |
| 56 |
|
|
| 57 |
|
VARIABLE vv[NVARS] = { /* variable-value pairs */ |
| 58 |
|
{"objects", 3, 0, NULL, catvalues}, |
| 78 |
|
{"PENUMBRAS", 3, 0, NULL, boolvalue}, |
| 79 |
|
{"VARIABILITY", 3, 0, NULL, qualvalue}, |
| 80 |
|
{"REPORT", 3, 0, NULL, onevalue}, |
| 81 |
+ |
{"RAWFILE", 3, 0, NULL, onevalue}, |
| 82 |
+ |
{"ZFILE", 2, 0, NULL, onevalue}, |
| 83 |
|
}; |
| 84 |
|
|
| 85 |
|
VARIABLE *matchvar(); |
| 101 |
|
|
| 102 |
|
/* overture calculation file */ |
| 103 |
|
#ifdef NIX |
| 104 |
< |
char overfile[] = "overture.raw"; |
| 104 |
> |
char overfile[] = "overture.unf"; |
| 105 |
|
#else |
| 106 |
|
char overfile[] = "/dev/null"; |
| 107 |
|
#endif |
| 121 |
|
int nowarn = 0; /* no warnings */ |
| 122 |
|
int explicate = 0; /* explicate variables */ |
| 123 |
|
int silent = 0; /* do work silently */ |
| 124 |
+ |
int touchonly = 0; /* touch files only */ |
| 125 |
|
int noaction = 0; /* don't do anything */ |
| 126 |
|
int sayview = 0; /* print view out */ |
| 127 |
|
char *rvdevice = NULL; /* rview output device */ |
| 153 |
|
case 'n': |
| 154 |
|
noaction++; |
| 155 |
|
break; |
| 156 |
+ |
case 't': |
| 157 |
+ |
touchonly++; |
| 158 |
+ |
break; |
| 159 |
|
case 'e': |
| 160 |
|
explicate++; |
| 161 |
|
break; |
| 207 |
|
exit(0); |
| 208 |
|
userr: |
| 209 |
|
fprintf(stderr, |
| 210 |
< |
"Usage: %s [-s][-n][-e][-V][-v view][-o dev] rfile [VAR=value ..]\n", |
| 210 |
> |
"Usage: %s [-s][-n][-t][-e][-V][-v view][-o dev] rfile [VAR=value ..]\n", |
| 211 |
|
progname); |
| 212 |
|
exit(1); |
| 213 |
|
} |
| 563 |
|
extern FILE *popen(); |
| 564 |
|
static double oorg[3], osiz = 0.; |
| 565 |
|
double min[3], max[3]; |
| 566 |
< |
char buf[512]; |
| 566 |
> |
char buf[1024]; |
| 567 |
|
FILE *fp; |
| 568 |
|
register int i; |
| 569 |
|
|
| 689 |
|
oconv() /* run oconv and mkillum if necessary */ |
| 690 |
|
{ |
| 691 |
|
static char illumtmp[] = "ilXXXXXX"; |
| 692 |
< |
char combuf[512], ocopts[64], mkopts[64]; |
| 692 |
> |
char combuf[1024], ocopts[64], mkopts[64]; |
| 693 |
|
|
| 694 |
|
oconvopts(ocopts); /* get options */ |
| 695 |
|
if (octreedate < scenedate) { /* check date on original octree */ |
| 696 |
< |
/* build command */ |
| 697 |
< |
if (vdef(MATERIAL)) |
| 698 |
< |
sprintf(combuf, "oconv%s %s %s > %s", ocopts, |
| 699 |
< |
vval(MATERIAL), vval(SCENE), vval(OCTREE)); |
| 700 |
< |
else |
| 701 |
< |
sprintf(combuf, "oconv%s %s > %s", ocopts, |
| 702 |
< |
vval(SCENE), vval(OCTREE)); |
| 703 |
< |
|
| 704 |
< |
if (runcom(combuf)) { /* run it */ |
| 705 |
< |
fprintf(stderr, |
| 696 |
> |
if (touchonly && octreedate) |
| 697 |
> |
touch(vval(OCTREE)); |
| 698 |
> |
else { /* build command */ |
| 699 |
> |
if (vdef(MATERIAL)) |
| 700 |
> |
sprintf(combuf, "oconv%s %s %s > %s", ocopts, |
| 701 |
> |
vval(MATERIAL), vval(SCENE), |
| 702 |
> |
vval(OCTREE)); |
| 703 |
> |
else |
| 704 |
> |
sprintf(combuf, "oconv%s %s > %s", ocopts, |
| 705 |
> |
vval(SCENE), vval(OCTREE)); |
| 706 |
> |
|
| 707 |
> |
if (runcom(combuf)) { /* run it */ |
| 708 |
> |
fprintf(stderr, |
| 709 |
|
"%s: error generating octree\n\t%s removed\n", |
| 710 |
< |
progname, vval(OCTREE)); |
| 711 |
< |
unlink(vval(OCTREE)); |
| 712 |
< |
exit(1); |
| 710 |
> |
progname, vval(OCTREE)); |
| 711 |
> |
unlink(vval(OCTREE)); |
| 712 |
> |
exit(1); |
| 713 |
> |
} |
| 714 |
|
} |
| 715 |
|
octreedate = time((time_t *)NULL); |
| 716 |
+ |
if (octreedate < scenedate) /* in case clock is off */ |
| 717 |
+ |
octreedate = scenedate; |
| 718 |
|
} |
| 719 |
|
if (oct1name == vval(OCTREE)) /* no mkillum? */ |
| 720 |
|
oct1date = octreedate > matdate ? octreedate : matdate; |
| 723 |
|
return; |
| 724 |
|
/* make octree0 */ |
| 725 |
|
if (oct0date < scenedate | oct0date < illumdate) { |
| 726 |
< |
/* build command */ |
| 726 |
> |
if (touchonly && oct0date) |
| 727 |
> |
touch(oct0name); |
| 728 |
> |
else { /* build command */ |
| 729 |
> |
if (octreedate) |
| 730 |
> |
sprintf(combuf, "oconv%s -i %s %s > %s", ocopts, |
| 731 |
> |
vval(OCTREE), vval(ILLUM), oct0name); |
| 732 |
> |
else if (vdef(MATERIAL)) |
| 733 |
> |
sprintf(combuf, "oconv%s %s %s > %s", ocopts, |
| 734 |
> |
vval(MATERIAL), vval(ILLUM), oct0name); |
| 735 |
> |
else |
| 736 |
> |
sprintf(combuf, "oconv%s %s > %s", ocopts, |
| 737 |
> |
vval(ILLUM), oct0name); |
| 738 |
> |
if (runcom(combuf)) { /* run it */ |
| 739 |
> |
fprintf(stderr, |
| 740 |
> |
"%s: error generating octree\n\t%s removed\n", |
| 741 |
> |
progname, oct0name); |
| 742 |
> |
unlink(oct0name); |
| 743 |
> |
exit(1); |
| 744 |
> |
} |
| 745 |
> |
} |
| 746 |
> |
oct0date = time((time_t *)NULL); |
| 747 |
> |
if (oct0date < octreedate) /* in case clock is off */ |
| 748 |
> |
oct0date = octreedate; |
| 749 |
> |
if (oct0date < illumdate) /* ditto */ |
| 750 |
> |
oct0date = illumdate; |
| 751 |
> |
} |
| 752 |
> |
if (touchonly && oct1date) |
| 753 |
> |
touch(oct1name); |
| 754 |
> |
else { |
| 755 |
> |
mkillumopts(mkopts); /* build mkillum command */ |
| 756 |
> |
mktemp(illumtmp); |
| 757 |
> |
sprintf(combuf, "mkillum%s %s \"<\" %s > %s", mkopts, |
| 758 |
> |
oct0name, vval(ILLUM), illumtmp); |
| 759 |
> |
if (runcom(combuf)) { /* run it */ |
| 760 |
> |
fprintf(stderr, "%s: error running mkillum\n", |
| 761 |
> |
progname); |
| 762 |
> |
unlink(illumtmp); |
| 763 |
> |
exit(1); |
| 764 |
> |
} |
| 765 |
> |
/* make octree1 (frozen) */ |
| 766 |
|
if (octreedate) |
| 767 |
< |
sprintf(combuf, "oconv%s -i %s %s > %s", ocopts, |
| 768 |
< |
vval(OCTREE), vval(ILLUM), oct0name); |
| 767 |
> |
sprintf(combuf, "oconv%s -f -i %s %s > %s", ocopts, |
| 768 |
> |
vval(OCTREE), illumtmp, oct1name); |
| 769 |
|
else if (vdef(MATERIAL)) |
| 770 |
< |
sprintf(combuf, "oconv%s %s %s > %s", ocopts, |
| 771 |
< |
vval(MATERIAL), vval(ILLUM), oct0name); |
| 770 |
> |
sprintf(combuf, "oconv%s -f %s %s > %s", ocopts, |
| 771 |
> |
vval(MATERIAL), illumtmp, oct1name); |
| 772 |
|
else |
| 773 |
< |
sprintf(combuf, "oconv%s %s > %s", ocopts, |
| 774 |
< |
vval(ILLUM), oct0name); |
| 773 |
> |
sprintf(combuf, "oconv%s -f %s > %s", ocopts, |
| 774 |
> |
illumtmp, oct1name); |
| 775 |
|
if (runcom(combuf)) { /* run it */ |
| 776 |
|
fprintf(stderr, |
| 777 |
|
"%s: error generating octree\n\t%s removed\n", |
| 778 |
< |
progname, oct0name); |
| 779 |
< |
unlink(oct0name); |
| 778 |
> |
progname, oct1name); |
| 779 |
> |
unlink(oct1name); |
| 780 |
> |
unlink(illumtmp); |
| 781 |
|
exit(1); |
| 782 |
|
} |
| 783 |
< |
oct0date = time((time_t *)NULL); |
| 783 |
> |
rmfile(illumtmp); |
| 784 |
|
} |
| 731 |
– |
mkillumopts(mkopts); /* build mkillum command */ |
| 732 |
– |
mktemp(illumtmp); |
| 733 |
– |
sprintf(combuf, "mkillum%s %s \"<\" %s > %s", mkopts, |
| 734 |
– |
oct0name, vval(ILLUM), illumtmp); |
| 735 |
– |
if (runcom(combuf)) { /* run it */ |
| 736 |
– |
fprintf(stderr, "%s: error running mkillum\n", progname); |
| 737 |
– |
unlink(illumtmp); |
| 738 |
– |
exit(1); |
| 739 |
– |
} |
| 740 |
– |
/* make octree1 (frozen) */ |
| 741 |
– |
if (octreedate) |
| 742 |
– |
sprintf(combuf, "oconv%s -f -i %s %s > %s", ocopts, |
| 743 |
– |
vval(OCTREE), illumtmp, oct1name); |
| 744 |
– |
else if (vdef(MATERIAL)) |
| 745 |
– |
sprintf(combuf, "oconv%s -f %s %s > %s", ocopts, |
| 746 |
– |
vval(MATERIAL), illumtmp, oct1name); |
| 747 |
– |
else |
| 748 |
– |
sprintf(combuf, "oconv%s -f %s > %s", ocopts, |
| 749 |
– |
illumtmp, oct1name); |
| 750 |
– |
if (runcom(combuf)) { /* run it */ |
| 751 |
– |
fprintf(stderr, |
| 752 |
– |
"%s: error generating octree\n\t%s removed\n", |
| 753 |
– |
progname, oct1name); |
| 754 |
– |
unlink(oct1name); |
| 755 |
– |
exit(1); |
| 756 |
– |
} |
| 785 |
|
oct1date = time((time_t *)NULL); |
| 786 |
< |
rmfile(illumtmp); |
| 786 |
> |
if (oct1date < oct0date) /* in case clock is off */ |
| 787 |
> |
oct1date = oct0date; |
| 788 |
|
} |
| 789 |
|
|
| 790 |
|
|
| 830 |
|
if (!(afdate = fdate(vval(AMBFILE)))) |
| 831 |
|
return; |
| 832 |
|
if (oct1date > afdate) |
| 833 |
< |
rmfile(vval(AMBFILE)); |
| 833 |
> |
if (touchonly) |
| 834 |
> |
touch(vval(AMBFILE)); |
| 835 |
> |
else |
| 836 |
> |
rmfile(vval(AMBFILE)); |
| 837 |
|
} |
| 838 |
|
|
| 839 |
|
|
| 882 |
|
&siz[0], &org[1], &siz[1], &org[2], &siz[2]) != 6) |
| 883 |
|
badvalue(ZONE); |
| 884 |
|
siz[0] -= org[0]; siz[1] -= org[1]; siz[2] -= org[2]; |
| 885 |
+ |
if (siz[0] <= FTINY | siz[1] <= FTINY | siz[2] <= FTINY) |
| 886 |
+ |
badvalue(ZONE); |
| 887 |
|
getoctcube(org, &d); |
| 888 |
|
d *= 3./(siz[0]+siz[1]+siz[2]); |
| 889 |
|
switch (vscale(DETAIL)) { |
| 942 |
|
register char *op; |
| 943 |
|
char *po; |
| 944 |
|
{ |
| 945 |
< |
double d, org[3], siz[3]; |
| 945 |
> |
double d, org[3], siz[3], asz; |
| 946 |
|
|
| 947 |
|
*op = '\0'; |
| 948 |
|
*po = '\0'; |
| 950 |
|
&siz[0], &org[1], &siz[1], &org[2], &siz[2]) != 6) |
| 951 |
|
badvalue(ZONE); |
| 952 |
|
siz[0] -= org[0]; siz[1] -= org[1]; siz[2] -= org[2]; |
| 953 |
+ |
if (siz[0] <= FTINY | siz[1] <= FTINY | siz[2] <= FTINY) |
| 954 |
+ |
badvalue(ZONE); |
| 955 |
|
getoctcube(org, &d); |
| 956 |
< |
d *= 3./(siz[0]+siz[1]+siz[2]); |
| 956 |
> |
asz = (siz[0]+siz[1]+siz[2])/3.; |
| 957 |
> |
d /= asz; |
| 958 |
|
switch (vscale(DETAIL)) { |
| 959 |
|
case LOW: |
| 960 |
|
po = addarg(po, vbool(PENUMBRAS) ? "-ps 4" : "-ps 8"); |
| 961 |
|
op = addarg(op, "-dp 256"); |
| 962 |
|
sprintf(op, " -ar %d", (int)(8*d)); |
| 963 |
|
op += strlen(op); |
| 964 |
+ |
sprintf(op, " -ms %.2g", asz/20.); |
| 965 |
+ |
op += strlen(op); |
| 966 |
|
break; |
| 967 |
|
case MEDIUM: |
| 968 |
|
po = addarg(po, vbool(PENUMBRAS) ? "-ps 3" : "-ps 6"); |
| 969 |
|
op = addarg(op, "-dp 512"); |
| 970 |
|
sprintf(op, " -ar %d", (int)(16*d)); |
| 971 |
|
op += strlen(op); |
| 972 |
+ |
sprintf(op, " -ms %.2g", asz/40.); |
| 973 |
+ |
op += strlen(op); |
| 974 |
|
break; |
| 975 |
|
case HIGH: |
| 976 |
|
po = addarg(po, vbool(PENUMBRAS) ? "-ps 2" : "-ps 4"); |
| 977 |
|
op = addarg(op, "-dp 1024"); |
| 978 |
|
sprintf(op, " -ar %d", (int)(32*d)); |
| 979 |
|
op += strlen(op); |
| 980 |
+ |
sprintf(op, " -ms %.2g", asz/80.); |
| 981 |
+ |
op += strlen(op); |
| 982 |
|
break; |
| 983 |
|
} |
| 984 |
|
po = addarg(po, "-pt .08"); |
| 1020 |
|
register char *op; |
| 1021 |
|
char *po; |
| 1022 |
|
{ |
| 1023 |
< |
double d, org[3], siz[3]; |
| 1023 |
> |
double d, org[3], siz[3], asz; |
| 1024 |
|
|
| 1025 |
|
*op = '\0'; |
| 1026 |
|
*po = '\0'; |
| 1028 |
|
&siz[0], &org[1], &siz[1], &org[2], &siz[2]) != 6) |
| 1029 |
|
badvalue(ZONE); |
| 1030 |
|
siz[0] -= org[0]; siz[1] -= org[1]; siz[2] -= org[2]; |
| 1031 |
+ |
if (siz[0] <= FTINY | siz[1] <= FTINY | siz[2] <= FTINY) |
| 1032 |
+ |
badvalue(ZONE); |
| 1033 |
|
getoctcube(org, &d); |
| 1034 |
< |
d *= 3./(siz[0]+siz[1]+siz[2]); |
| 1034 |
> |
asz = (siz[0]+siz[1]+siz[2])/3.; |
| 1035 |
> |
d /= asz; |
| 1036 |
|
switch (vscale(DETAIL)) { |
| 1037 |
|
case LOW: |
| 1038 |
|
po = addarg(po, vbool(PENUMBRAS) ? "-ps 1" : "-ps 8"); |
| 1039 |
|
op = addarg(op, "-dp 1024"); |
| 1040 |
|
sprintf(op, " -ar %d", (int)(16*d)); |
| 1041 |
|
op += strlen(op); |
| 1042 |
+ |
sprintf(op, " -ms %.2g", asz/40.); |
| 1043 |
+ |
op += strlen(op); |
| 1044 |
|
break; |
| 1045 |
|
case MEDIUM: |
| 1046 |
|
po = addarg(po, vbool(PENUMBRAS) ? "-ps 1" : "-ps 5"); |
| 1047 |
|
op = addarg(op, "-dp 2048"); |
| 1048 |
|
sprintf(op, " -ar %d", (int)(32*d)); |
| 1049 |
|
op += strlen(op); |
| 1050 |
+ |
sprintf(op, " -ms %.2g", asz/80.); |
| 1051 |
+ |
op += strlen(op); |
| 1052 |
|
break; |
| 1053 |
|
case HIGH: |
| 1054 |
|
po = addarg(po, vbool(PENUMBRAS) ? "-ps 1" : "-ps 3"); |
| 1055 |
|
op = addarg(op, "-dp 4096"); |
| 1056 |
|
sprintf(op, " -ar %d", (int)(64*d)); |
| 1057 |
|
op += strlen(op); |
| 1058 |
+ |
sprintf(op, " -ms %.2g", asz/160.); |
| 1059 |
+ |
op += strlen(op); |
| 1060 |
|
break; |
| 1061 |
|
} |
| 1062 |
|
po = addarg(po, "-pt .04"); |
| 1063 |
|
if (vbool(PENUMBRAS)) |
| 1064 |
< |
op = addarg(op, "-ds .1 -dj .7"); |
| 1064 |
> |
op = addarg(op, "-ds .1 -dj .65"); |
| 1065 |
|
else |
| 1066 |
|
op = addarg(op, "-ds .2"); |
| 1067 |
|
op = addarg(op, "-dt .05 -dc .75 -dr 3 -sj 1 -st .01"); |
| 1198 |
|
zpos = -1; vs++; |
| 1199 |
|
} |
| 1200 |
|
viewtype = 'v'; |
| 1201 |
< |
if (*vs == 'v' | *vs == 'l' | *vs == 'a' | *vs == 'h') |
| 1201 |
> |
if (*vs == 'v' | *vs == 'l' | *vs == 'a' | *vs == 'h' | *vs == 'c') |
| 1202 |
|
viewtype = *vs++; |
| 1203 |
|
cp = viewopts; |
| 1204 |
|
if ((!*vs || isspace(*vs)) && (xpos|ypos|zpos)) { /* got one! */ |
| 1209 |
|
badvalue(ZONE); |
| 1210 |
|
for (i = 0; i < 3; i++) { |
| 1211 |
|
dim[i] -= cent[i]; |
| 1212 |
+ |
if (dim[i] <= FTINY) |
| 1213 |
+ |
badvalue(ZONE); |
| 1214 |
|
cent[i] += .5*dim[i]; |
| 1215 |
|
} |
| 1216 |
|
mult = vlet(ZONE)=='E' ? 2. : .45 ; |
| 1253 |
|
case 'h': |
| 1254 |
|
cp = addarg(cp, "-vh 180 -vv 180"); |
| 1255 |
|
break; |
| 1256 |
+ |
case 'c': |
| 1257 |
+ |
cp = addarg(cp, "-vh 180 -vv 90"); |
| 1258 |
+ |
break; |
| 1259 |
|
} |
| 1260 |
|
} else { |
| 1261 |
|
while (!isspace(*vs)) /* else skip id */ |
| 1383 |
|
char *vw; |
| 1384 |
|
char combuf[512]; |
| 1385 |
|
/* build command */ |
| 1386 |
< |
if ((vw = getview(0, NULL)) == NULL) |
| 1386 |
> |
if (touchonly || (vw = getview(0, NULL)) == NULL) |
| 1387 |
|
return; |
| 1388 |
|
if (sayview) |
| 1389 |
|
printview(vw); |
| 1404 |
|
char *opts, *po; |
| 1405 |
|
{ |
| 1406 |
|
char combuf[1024]; |
| 1407 |
< |
char rawfile[MAXPATH], picfile[MAXPATH], rep[MAXPATH+16], res[32]; |
| 1407 |
> |
char rawfile[MAXPATH], picfile[MAXPATH]; |
| 1408 |
> |
char zopt[MAXPATH+4], rep[MAXPATH+16], res[32]; |
| 1409 |
|
char pfopts[128]; |
| 1410 |
|
char vs[32], *vw; |
| 1411 |
|
int vn, mult; |
| 1412 |
+ |
time_t rfdt, pfdt; |
| 1413 |
|
/* get pfilt options */ |
| 1414 |
|
pfiltopts(pfopts); |
| 1415 |
|
/* get resolution, reporting */ |
| 1458 |
|
if (!vs[0]) |
| 1459 |
|
sprintf(vs, "%d", vn); |
| 1460 |
|
sprintf(picfile, "%s_%s.pic", vval(PICTURE), vs); |
| 1461 |
+ |
if (vdef(ZFILE)) |
| 1462 |
+ |
sprintf(zopt, " -z %s_%s.zbf", vval(ZFILE), vs); |
| 1463 |
+ |
else |
| 1464 |
+ |
zopt[0] = '\0'; |
| 1465 |
|
/* check date on picture */ |
| 1466 |
< |
if (fdate(picfile) >= oct1date) |
| 1466 |
> |
pfdt = fdate(picfile); |
| 1467 |
> |
if (pfdt >= oct1date) |
| 1468 |
|
continue; |
| 1469 |
+ |
/* get raw file name */ |
| 1470 |
+ |
sprintf(rawfile, "%s_%s.unf", |
| 1471 |
+ |
vdef(RAWFILE) ? vval(RAWFILE) : vval(PICTURE), vs); |
| 1472 |
+ |
rfdt = fdate(rawfile); |
| 1473 |
+ |
if (touchonly) { /* update times only */ |
| 1474 |
+ |
if (rfdt) { |
| 1475 |
+ |
if (rfdt < oct1date) |
| 1476 |
+ |
touch(rawfile); |
| 1477 |
+ |
} else if (pfdt && pfdt < oct1date) |
| 1478 |
+ |
touch(picfile); |
| 1479 |
+ |
continue; |
| 1480 |
+ |
} |
| 1481 |
|
/* build rpict command */ |
| 1482 |
< |
sprintf(rawfile, "%s_%s.raw", vval(PICTURE), vs); |
| 1483 |
< |
if (fdate(rawfile) >= oct1date) /* recover */ |
| 1484 |
< |
sprintf(combuf, "rpict%s%s%s -ro %s %s", |
| 1409 |
< |
rep, po, opts, rawfile, oct1name); |
| 1482 |
> |
if (rfdt >= oct1date) /* recover */ |
| 1483 |
> |
sprintf(combuf, "rpict%s%s%s%s -ro %s %s", |
| 1484 |
> |
rep, po, opts, zopt, rawfile, oct1name); |
| 1485 |
|
else { |
| 1486 |
|
if (overture) { /* run overture calculation */ |
| 1487 |
|
sprintf(combuf, |
| 1498 |
|
rmfile(overfile); |
| 1499 |
|
#endif |
| 1500 |
|
} |
| 1501 |
< |
sprintf(combuf, "rpict%s %s %s%s%s %s > %s", |
| 1502 |
< |
rep, vw, res, po, opts, |
| 1503 |
< |
oct1name, rawfile); |
| 1501 |
> |
sprintf(combuf, "rpict%s %s %s%s%s%s %s > %s", |
| 1502 |
> |
rep, vw, res, po, opts, zopt, |
| 1503 |
> |
oct1name, rawfile); |
| 1504 |
|
} |
| 1505 |
|
if (runcom(combuf)) { /* run rpict */ |
| 1506 |
|
fprintf(stderr, "%s: error rendering view %s\n", |
| 1507 |
|
progname, vs); |
| 1508 |
|
exit(1); |
| 1509 |
|
} |
| 1510 |
+ |
if (!vdef(RAWFILE) || strcmp(vval(RAWFILE),vval(PICTURE))) { |
| 1511 |
|
/* build pfilt command */ |
| 1512 |
< |
if (mult > 1) |
| 1513 |
< |
sprintf(combuf, "pfilt%s -x /%d -y /%d %s > %s", |
| 1512 |
> |
if (mult > 1) |
| 1513 |
> |
sprintf(combuf, "pfilt%s -x /%d -y /%d %s > %s", |
| 1514 |
|
pfopts, mult, mult, rawfile, picfile); |
| 1515 |
< |
else |
| 1516 |
< |
sprintf(combuf, "pfilt%s %s > %s", pfopts, |
| 1517 |
< |
rawfile, picfile); |
| 1518 |
< |
if (runcom(combuf)) { /* run pfilt */ |
| 1519 |
< |
fprintf(stderr, |
| 1520 |
< |
"%s: error filtering view %s\n\t%s removed\n", |
| 1521 |
< |
progname, vs, picfile); |
| 1522 |
< |
unlink(picfile); |
| 1523 |
< |
exit(1); |
| 1515 |
> |
else |
| 1516 |
> |
sprintf(combuf, "pfilt%s %s > %s", pfopts, |
| 1517 |
> |
rawfile, picfile); |
| 1518 |
> |
if (runcom(combuf)) { /* run pfilt */ |
| 1519 |
> |
fprintf(stderr, |
| 1520 |
> |
"%s: error filtering view %s\n\t%s removed\n", |
| 1521 |
> |
progname, vs, picfile); |
| 1522 |
> |
unlink(picfile); |
| 1523 |
> |
exit(1); |
| 1524 |
> |
} |
| 1525 |
|
} |
| 1526 |
< |
/* remove raw file */ |
| 1527 |
< |
rmfile(rawfile); |
| 1526 |
> |
/* remove/rename raw file */ |
| 1527 |
> |
if (vdef(RAWFILE)) { |
| 1528 |
> |
sprintf(combuf, "%s_%s.pic", vval(RAWFILE), vs); |
| 1529 |
> |
mvfile(rawfile, combuf); |
| 1530 |
> |
} else |
| 1531 |
> |
rmfile(rawfile); |
| 1532 |
|
} |
| 1533 |
|
} |
| 1534 |
|
|
| 1535 |
|
|
| 1536 |
+ |
touch(fn) /* update a file */ |
| 1537 |
+ |
char *fn; |
| 1538 |
+ |
{ |
| 1539 |
+ |
if (!silent) |
| 1540 |
+ |
printf("\ttouch %s\n", fn); |
| 1541 |
+ |
if (noaction) |
| 1542 |
+ |
return(0); |
| 1543 |
+ |
#ifdef notused |
| 1544 |
+ |
if (access(fn, F_OK) == -1) /* create it */ |
| 1545 |
+ |
if (close(open(fn, O_WRONLY|O_CREAT, 0666)) == -1) |
| 1546 |
+ |
return(-1); |
| 1547 |
+ |
#endif |
| 1548 |
+ |
return(setfdate(fn, time((time_t *)NULL))); |
| 1549 |
+ |
} |
| 1550 |
+ |
|
| 1551 |
+ |
|
| 1552 |
|
runcom(cs) /* run command */ |
| 1553 |
|
char *cs; |
| 1554 |
|
{ |
| 1573 |
|
if (noaction) |
| 1574 |
|
return(0); |
| 1575 |
|
return(unlink(fn)); |
| 1576 |
+ |
} |
| 1577 |
+ |
|
| 1578 |
+ |
|
| 1579 |
+ |
mvfile(fold, fnew) /* move a file */ |
| 1580 |
+ |
char *fold, *fnew; |
| 1581 |
+ |
{ |
| 1582 |
+ |
if (!silent) |
| 1583 |
+ |
#ifdef MSDOS |
| 1584 |
+ |
printf("\trename %s %s\n", fold, fnew); |
| 1585 |
+ |
#else |
| 1586 |
+ |
printf("\tmv %s %s\n", fold, fnew); |
| 1587 |
+ |
#endif |
| 1588 |
+ |
if (noaction) |
| 1589 |
+ |
return(0); |
| 1590 |
+ |
return(rename(fold, fnew)); |
| 1591 |
|
} |
| 1592 |
|
|
| 1593 |
|
|