117 |
|
int nowarn = 0; /* no warnings */ |
118 |
|
int explicate = 0; /* explicate variables */ |
119 |
|
int silent = 0; /* do work silently */ |
120 |
+ |
int touchonly = 0; /* touch files only */ |
121 |
|
int noaction = 0; /* don't do anything */ |
122 |
|
int sayview = 0; /* print view out */ |
123 |
|
char *rvdevice = NULL; /* rview output device */ |
149 |
|
case 'n': |
150 |
|
noaction++; |
151 |
|
break; |
152 |
+ |
case 't': |
153 |
+ |
touchonly++; |
154 |
+ |
break; |
155 |
|
case 'e': |
156 |
|
explicate++; |
157 |
|
break; |
203 |
|
exit(0); |
204 |
|
userr: |
205 |
|
fprintf(stderr, |
206 |
< |
"Usage: %s [-s][-n][-e][-V][-v view][-o dev] rfile [VAR=value ..]\n", |
206 |
> |
"Usage: %s [-s][-n][-t][-e][-V][-v view][-o dev] rfile [VAR=value ..]\n", |
207 |
|
progname); |
208 |
|
exit(1); |
209 |
|
} |
689 |
|
|
690 |
|
oconvopts(ocopts); /* get options */ |
691 |
|
if (octreedate < scenedate) { /* check date on original octree */ |
692 |
< |
/* build command */ |
693 |
< |
if (vdef(MATERIAL)) |
694 |
< |
sprintf(combuf, "oconv%s %s %s > %s", ocopts, |
695 |
< |
vval(MATERIAL), vval(SCENE), vval(OCTREE)); |
696 |
< |
else |
697 |
< |
sprintf(combuf, "oconv%s %s > %s", ocopts, |
698 |
< |
vval(SCENE), vval(OCTREE)); |
699 |
< |
|
700 |
< |
if (runcom(combuf)) { /* run it */ |
701 |
< |
fprintf(stderr, |
692 |
> |
if (touchonly && octreedate) |
693 |
> |
touch(vval(OCTREE)); |
694 |
> |
else { /* build command */ |
695 |
> |
if (vdef(MATERIAL)) |
696 |
> |
sprintf(combuf, "oconv%s %s %s > %s", ocopts, |
697 |
> |
vval(MATERIAL), vval(SCENE), |
698 |
> |
vval(OCTREE)); |
699 |
> |
else |
700 |
> |
sprintf(combuf, "oconv%s %s > %s", ocopts, |
701 |
> |
vval(SCENE), vval(OCTREE)); |
702 |
> |
|
703 |
> |
if (runcom(combuf)) { /* run it */ |
704 |
> |
fprintf(stderr, |
705 |
|
"%s: error generating octree\n\t%s removed\n", |
706 |
< |
progname, vval(OCTREE)); |
707 |
< |
unlink(vval(OCTREE)); |
708 |
< |
exit(1); |
706 |
> |
progname, vval(OCTREE)); |
707 |
> |
unlink(vval(OCTREE)); |
708 |
> |
exit(1); |
709 |
> |
} |
710 |
|
} |
711 |
|
octreedate = time((time_t *)NULL); |
712 |
+ |
if (octreedate < scenedate) /* in case clock is off */ |
713 |
+ |
octreedate = scenedate; |
714 |
|
} |
715 |
|
if (oct1name == vval(OCTREE)) /* no mkillum? */ |
716 |
|
oct1date = octreedate > matdate ? octreedate : matdate; |
719 |
|
return; |
720 |
|
/* make octree0 */ |
721 |
|
if (oct0date < scenedate | oct0date < illumdate) { |
722 |
< |
/* build command */ |
722 |
> |
if (touchonly && oct0date) |
723 |
> |
touch(oct0name); |
724 |
> |
else { /* build command */ |
725 |
> |
if (octreedate) |
726 |
> |
sprintf(combuf, "oconv%s -i %s %s > %s", ocopts, |
727 |
> |
vval(OCTREE), vval(ILLUM), oct0name); |
728 |
> |
else if (vdef(MATERIAL)) |
729 |
> |
sprintf(combuf, "oconv%s %s %s > %s", ocopts, |
730 |
> |
vval(MATERIAL), vval(ILLUM), oct0name); |
731 |
> |
else |
732 |
> |
sprintf(combuf, "oconv%s %s > %s", ocopts, |
733 |
> |
vval(ILLUM), oct0name); |
734 |
> |
if (runcom(combuf)) { /* run it */ |
735 |
> |
fprintf(stderr, |
736 |
> |
"%s: error generating octree\n\t%s removed\n", |
737 |
> |
progname, oct0name); |
738 |
> |
unlink(oct0name); |
739 |
> |
exit(1); |
740 |
> |
} |
741 |
> |
} |
742 |
> |
oct0date = time((time_t *)NULL); |
743 |
> |
if (oct0date < octreedate) /* in case clock is off */ |
744 |
> |
oct0date = octreedate; |
745 |
> |
if (oct0date < illumdate) /* ditto */ |
746 |
> |
oct0date = illumdate; |
747 |
> |
} |
748 |
> |
if (touchonly && oct1date) |
749 |
> |
touch(oct1name); |
750 |
> |
else { |
751 |
> |
mkillumopts(mkopts); /* build mkillum command */ |
752 |
> |
mktemp(illumtmp); |
753 |
> |
sprintf(combuf, "mkillum%s %s \"<\" %s > %s", mkopts, |
754 |
> |
oct0name, vval(ILLUM), illumtmp); |
755 |
> |
if (runcom(combuf)) { /* run it */ |
756 |
> |
fprintf(stderr, "%s: error running mkillum\n", |
757 |
> |
progname); |
758 |
> |
unlink(illumtmp); |
759 |
> |
exit(1); |
760 |
> |
} |
761 |
> |
/* make octree1 (frozen) */ |
762 |
|
if (octreedate) |
763 |
< |
sprintf(combuf, "oconv%s -i %s %s > %s", ocopts, |
764 |
< |
vval(OCTREE), vval(ILLUM), oct0name); |
763 |
> |
sprintf(combuf, "oconv%s -f -i %s %s > %s", ocopts, |
764 |
> |
vval(OCTREE), illumtmp, oct1name); |
765 |
|
else if (vdef(MATERIAL)) |
766 |
< |
sprintf(combuf, "oconv%s %s %s > %s", ocopts, |
767 |
< |
vval(MATERIAL), vval(ILLUM), oct0name); |
766 |
> |
sprintf(combuf, "oconv%s -f %s %s > %s", ocopts, |
767 |
> |
vval(MATERIAL), illumtmp, oct1name); |
768 |
|
else |
769 |
< |
sprintf(combuf, "oconv%s %s > %s", ocopts, |
770 |
< |
vval(ILLUM), oct0name); |
769 |
> |
sprintf(combuf, "oconv%s -f %s > %s", ocopts, |
770 |
> |
illumtmp, oct1name); |
771 |
|
if (runcom(combuf)) { /* run it */ |
772 |
|
fprintf(stderr, |
773 |
|
"%s: error generating octree\n\t%s removed\n", |
774 |
< |
progname, oct0name); |
775 |
< |
unlink(oct0name); |
774 |
> |
progname, oct1name); |
775 |
> |
unlink(oct1name); |
776 |
|
exit(1); |
777 |
|
} |
778 |
< |
oct0date = time((time_t *)NULL); |
778 |
> |
rmfile(illumtmp); |
779 |
|
} |
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 |
– |
} |
780 |
|
oct1date = time((time_t *)NULL); |
781 |
< |
rmfile(illumtmp); |
781 |
> |
if (oct1date < oct0date) /* in case clock is off */ |
782 |
> |
oct1date = oct0date; |
783 |
|
} |
784 |
|
|
785 |
|
|
825 |
|
if (!(afdate = fdate(vval(AMBFILE)))) |
826 |
|
return; |
827 |
|
if (oct1date > afdate) |
828 |
< |
rmfile(vval(AMBFILE)); |
828 |
> |
if (touchonly) |
829 |
> |
touch(vval(AMBFILE)); |
830 |
> |
else |
831 |
> |
rmfile(vval(AMBFILE)); |
832 |
|
} |
833 |
|
|
834 |
|
|
877 |
|
&siz[0], &org[1], &siz[1], &org[2], &siz[2]) != 6) |
878 |
|
badvalue(ZONE); |
879 |
|
siz[0] -= org[0]; siz[1] -= org[1]; siz[2] -= org[2]; |
880 |
+ |
if (siz[0] <= FTINY | siz[1] <= FTINY | siz[2] <= FTINY) |
881 |
+ |
badvalue(ZONE); |
882 |
|
getoctcube(org, &d); |
883 |
|
d *= 3./(siz[0]+siz[1]+siz[2]); |
884 |
|
switch (vscale(DETAIL)) { |
945 |
|
&siz[0], &org[1], &siz[1], &org[2], &siz[2]) != 6) |
946 |
|
badvalue(ZONE); |
947 |
|
siz[0] -= org[0]; siz[1] -= org[1]; siz[2] -= org[2]; |
948 |
+ |
if (siz[0] <= FTINY | siz[1] <= FTINY | siz[2] <= FTINY) |
949 |
+ |
badvalue(ZONE); |
950 |
|
getoctcube(org, &d); |
951 |
|
d *= 3./(siz[0]+siz[1]+siz[2]); |
952 |
|
switch (vscale(DETAIL)) { |
1016 |
|
&siz[0], &org[1], &siz[1], &org[2], &siz[2]) != 6) |
1017 |
|
badvalue(ZONE); |
1018 |
|
siz[0] -= org[0]; siz[1] -= org[1]; siz[2] -= org[2]; |
1019 |
+ |
if (siz[0] <= FTINY | siz[1] <= FTINY | siz[2] <= FTINY) |
1020 |
+ |
badvalue(ZONE); |
1021 |
|
getoctcube(org, &d); |
1022 |
|
d *= 3./(siz[0]+siz[1]+siz[2]); |
1023 |
|
switch (vscale(DETAIL)) { |
1042 |
|
} |
1043 |
|
po = addarg(po, "-pt .04"); |
1044 |
|
if (vbool(PENUMBRAS)) |
1045 |
< |
op = addarg(op, "-ds .1 -dj .7"); |
1045 |
> |
op = addarg(op, "-ds .1 -dj .65"); |
1046 |
|
else |
1047 |
|
op = addarg(op, "-ds .2"); |
1048 |
|
op = addarg(op, "-dt .05 -dc .75 -dr 3 -sj 1 -st .01"); |
1190 |
|
badvalue(ZONE); |
1191 |
|
for (i = 0; i < 3; i++) { |
1192 |
|
dim[i] -= cent[i]; |
1193 |
+ |
if (dim[i] <= FTINY) |
1194 |
+ |
badvalue(ZONE); |
1195 |
|
cent[i] += .5*dim[i]; |
1196 |
|
} |
1197 |
|
mult = vlet(ZONE)=='E' ? 2. : .45 ; |
1361 |
|
char *vw; |
1362 |
|
char combuf[512]; |
1363 |
|
/* build command */ |
1364 |
< |
if ((vw = getview(0, NULL)) == NULL) |
1364 |
> |
if (touchonly || (vw = getview(0, NULL)) == NULL) |
1365 |
|
return; |
1366 |
|
if (sayview) |
1367 |
|
printview(vw); |
1386 |
|
char pfopts[128]; |
1387 |
|
char vs[32], *vw; |
1388 |
|
int vn, mult; |
1389 |
+ |
time_t rfdt, pfdt; |
1390 |
|
/* get pfilt options */ |
1391 |
|
pfiltopts(pfopts); |
1392 |
|
/* get resolution, reporting */ |
1436 |
|
sprintf(vs, "%d", vn); |
1437 |
|
sprintf(picfile, "%s_%s.pic", vval(PICTURE), vs); |
1438 |
|
/* check date on picture */ |
1439 |
< |
if (fdate(picfile) >= oct1date) |
1439 |
> |
pfdt = fdate(picfile); |
1440 |
> |
if (pfdt >= oct1date) |
1441 |
|
continue; |
1442 |
< |
/* build rpict command */ |
1442 |
> |
/* get raw file name */ |
1443 |
|
sprintf(rawfile, "%s_%s.raw", vval(PICTURE), vs); |
1444 |
< |
if (fdate(rawfile) >= oct1date) /* recover */ |
1444 |
> |
rfdt = fdate(rawfile); |
1445 |
> |
if (touchonly) { /* update times only */ |
1446 |
> |
if (rfdt) { |
1447 |
> |
if (rfdt < oct1date) |
1448 |
> |
touch(rawfile); |
1449 |
> |
} else if (pfdt && pfdt < oct1date) |
1450 |
> |
touch(picfile); |
1451 |
> |
continue; |
1452 |
> |
} |
1453 |
> |
/* build rpict command */ |
1454 |
> |
if (rfdt >= oct1date) /* recover */ |
1455 |
|
sprintf(combuf, "rpict%s%s%s -ro %s %s", |
1456 |
|
rep, po, opts, rawfile, oct1name); |
1457 |
|
else { |
1496 |
|
/* remove raw file */ |
1497 |
|
rmfile(rawfile); |
1498 |
|
} |
1499 |
+ |
} |
1500 |
+ |
|
1501 |
+ |
|
1502 |
+ |
touch(fn) /* update a file */ |
1503 |
+ |
char *fn; |
1504 |
+ |
{ |
1505 |
+ |
if (!silent) |
1506 |
+ |
printf("\ttouch %s\n", fn); |
1507 |
+ |
if (noaction) |
1508 |
+ |
return(0); |
1509 |
+ |
#ifdef notused |
1510 |
+ |
if (access(fn, F_OK) == -1) /* create it */ |
1511 |
+ |
if (close(open(fn, O_WRONLY|O_CREAT, 0666)) == -1) |
1512 |
+ |
return(-1); |
1513 |
+ |
#endif |
1514 |
+ |
return(setfdate(fn, time((time_t *)NULL))); |
1515 |
|
} |
1516 |
|
|
1517 |
|
|