8 |
|
#include "standard.h" |
9 |
|
|
10 |
|
#include <ctype.h> |
11 |
+ |
#include <time.h> |
12 |
|
|
13 |
|
#include "platform.h" |
14 |
|
#include "view.h" |
15 |
|
#include "paths.h" |
16 |
|
#include "vars.h" |
17 |
|
|
18 |
+ |
#ifdef _WIN32 |
19 |
+ |
#define DELCMD "del" |
20 |
+ |
#define RENAMECMD "rename" |
21 |
+ |
#else |
22 |
+ |
#define DELCMD "rm -f" |
23 |
+ |
#define RENAMECMD "mv" |
24 |
+ |
#endif |
25 |
+ |
|
26 |
|
/* variables (alphabetical by name) */ |
27 |
|
#define AMBFILE 0 /* ambient file name */ |
28 |
|
#define DETAIL 1 /* level of scene detail */ |
89 |
|
char overfile[] = "overture.unf"; |
90 |
|
#endif |
91 |
|
|
83 |
– |
extern time_t time(); |
92 |
|
|
93 |
|
time_t scenedate; /* date of latest scene or object file */ |
94 |
|
time_t octreedate; /* date of octree */ |
169 |
|
goto userr; |
170 |
|
rifname = argv[i]; |
171 |
|
/* check command-line options */ |
172 |
< |
if (nprocs > 1 & viewselect != NULL) |
172 |
> |
if ((nprocs > 1) & (viewselect != NULL)) |
173 |
|
nprocs = 1; |
174 |
|
/* assign Radiance root file name */ |
175 |
|
rootname(radname, rifname); |
216 |
|
{ |
217 |
|
char *tp, *dp; |
218 |
|
|
219 |
< |
for (tp = NULL, dp = rn; *rn = *fn++; rn++) |
219 |
> |
for (tp = NULL, dp = rn; (*rn = *fn++); rn++) |
220 |
|
if (ISDIRSEP(*rn)) |
221 |
|
dp = rn; |
222 |
|
else if (*rn == '.') |
318 |
|
FILE *fp; |
319 |
|
register int i; |
320 |
|
|
321 |
< |
if (osiz <= FTINY) |
321 |
> |
if (osiz <= FTINY) { |
322 |
|
if (!nprocs && fdate(oct1name) < |
323 |
|
(scenedate>illumdate?scenedate:illumdate)) { |
324 |
|
/* run getbbox */ |
354 |
|
} |
355 |
|
pclose(fp); |
356 |
|
} |
357 |
+ |
} |
358 |
|
org[0] = oorg[0]; org[1] = oorg[1]; org[2] = oorg[2]; *sizp = osiz; |
359 |
|
} |
360 |
|
|
448 |
|
} |
449 |
|
if (oct1name == vval(OCTREE)) /* no mkillum? */ |
450 |
|
oct1date = octreedate > matdate ? octreedate : matdate; |
451 |
< |
if (oct1date >= octreedate & oct1date >= matdate |
452 |
< |
& oct1date >= illumdate) /* all done */ |
451 |
> |
if ((oct1date >= octreedate) & (oct1date >= matdate) |
452 |
> |
& (oct1date >= illumdate)) /* all done */ |
453 |
|
return; |
454 |
|
/* make octree0 */ |
455 |
< |
if (oct0date < scenedate | oct0date < illumdate) { |
455 |
> |
if ((oct0date < scenedate) | (oct0date < illumdate)) { |
456 |
|
if (touchonly && oct0date) |
457 |
|
touch(oct0name); |
458 |
|
else { /* build command */ |
523 |
|
register char *op, *arg; |
524 |
|
{ |
525 |
|
*op = ' '; |
526 |
< |
while (*++op = *arg++) |
526 |
> |
while ( (*++op = *arg++) ) |
527 |
|
; |
528 |
|
return(op); |
529 |
|
} |
559 |
|
return; |
560 |
|
if (!(afdate = fdate(vval(AMBFILE)))) |
561 |
|
return; |
562 |
< |
if (oct1date > afdate) |
562 |
> |
if (oct1date > afdate) { |
563 |
|
if (touchonly) |
564 |
|
touch(vval(AMBFILE)); |
565 |
|
else |
566 |
|
rmfile(vval(AMBFILE)); |
567 |
+ |
} |
568 |
|
} |
569 |
|
|
570 |
|
|
613 |
|
&siz[0], &org[1], &siz[1], &org[2], &siz[2]) != 6) |
614 |
|
badvalue(ZONE); |
615 |
|
siz[0] -= org[0]; siz[1] -= org[1]; siz[2] -= org[2]; |
616 |
< |
if (siz[0] <= FTINY | siz[1] <= FTINY | siz[2] <= FTINY) |
616 |
> |
if ((siz[0] <= FTINY) | (siz[1] <= FTINY) | (siz[2] <= FTINY)) |
617 |
|
badvalue(ZONE); |
618 |
|
getoctcube(org, &d); |
619 |
|
d *= 3./(siz[0]+siz[1]+siz[2]); |
621 |
|
case LOW: |
622 |
|
po = addarg(po, "-ps 16"); |
623 |
|
op = addarg(op, "-dp 64"); |
624 |
< |
sprintf(op, " -ar %d", (int)(4*d)); |
624 |
> |
sprintf(op, " -ar %d", (int)(8*d)); |
625 |
|
op += strlen(op); |
626 |
|
break; |
627 |
|
case MEDIUM: |
628 |
|
po = addarg(po, "-ps 8"); |
629 |
|
op = addarg(op, "-dp 128"); |
630 |
< |
sprintf(op, " -ar %d", (int)(8*d)); |
630 |
> |
sprintf(op, " -ar %d", (int)(16*d)); |
631 |
|
op += strlen(op); |
632 |
|
break; |
633 |
|
case HIGH: |
634 |
|
po = addarg(po, "-ps 4"); |
635 |
|
op = addarg(op, "-dp 256"); |
636 |
< |
sprintf(op, " -ar %d", (int)(16*d)); |
636 |
> |
sprintf(op, " -ar %d", (int)(32*d)); |
637 |
|
op += strlen(op); |
638 |
|
break; |
639 |
|
} |
650 |
|
overture = 0; |
651 |
|
switch (vscale(VARIABILITY)) { |
652 |
|
case LOW: |
653 |
< |
op = addarg(op, "-aa .4 -ad 64"); |
653 |
> |
op = addarg(op, "-aa .3 -ad 256"); |
654 |
|
break; |
655 |
|
case MEDIUM: |
656 |
< |
op = addarg(op, "-aa .3 -ad 128"); |
656 |
> |
op = addarg(op, "-aa .25 -ad 512"); |
657 |
|
break; |
658 |
|
case HIGH: |
659 |
< |
op = addarg(op, "-aa .25 -ad 256"); |
659 |
> |
op = addarg(op, "-aa .2 -ad 1024"); |
660 |
|
break; |
661 |
|
} |
662 |
|
op = addarg(op, "-as 0"); |
663 |
|
d = ambval(); |
664 |
|
sprintf(op, " -av %.2g %.2g %.2g", d, d, d); |
665 |
|
op += strlen(op); |
666 |
< |
op = addarg(op, "-lr 3 -lw .02"); |
666 |
> |
op = addarg(op, "-lr 6 -lw .01"); |
667 |
|
if (vdef(RENDER)) |
668 |
|
op = addarg(op, vval(RENDER)); |
669 |
|
} |
681 |
|
&siz[0], &org[1], &siz[1], &org[2], &siz[2]) != 6) |
682 |
|
badvalue(ZONE); |
683 |
|
siz[0] -= org[0]; siz[1] -= org[1]; siz[2] -= org[2]; |
684 |
< |
if (siz[0] <= FTINY | siz[1] <= FTINY | siz[2] <= FTINY) |
684 |
> |
if ((siz[0] <= FTINY) | (siz[1] <= FTINY) | (siz[2] <= FTINY)) |
685 |
|
badvalue(ZONE); |
686 |
|
getoctcube(org, &d); |
687 |
|
asz = (siz[0]+siz[1]+siz[2])/3.; |
690 |
|
case LOW: |
691 |
|
po = addarg(po, vbool(PENUMBRAS) ? "-ps 4" : "-ps 8"); |
692 |
|
op = addarg(op, "-dp 256"); |
693 |
< |
sprintf(op, " -ar %d", (int)(8*d)); |
693 |
> |
sprintf(op, " -ar %d", (int)(16*d)); |
694 |
|
op += strlen(op); |
695 |
|
sprintf(op, " -ms %.2g", asz/20.); |
696 |
|
op += strlen(op); |
698 |
|
case MEDIUM: |
699 |
|
po = addarg(po, vbool(PENUMBRAS) ? "-ps 3" : "-ps 6"); |
700 |
|
op = addarg(op, "-dp 512"); |
701 |
< |
sprintf(op, " -ar %d", (int)(16*d)); |
701 |
> |
sprintf(op, " -ar %d", (int)(32*d)); |
702 |
|
op += strlen(op); |
703 |
|
sprintf(op, " -ms %.2g", asz/40.); |
704 |
|
op += strlen(op); |
706 |
|
case HIGH: |
707 |
|
po = addarg(po, vbool(PENUMBRAS) ? "-ps 2" : "-ps 4"); |
708 |
|
op = addarg(op, "-dp 1024"); |
709 |
< |
sprintf(op, " -ar %d", (int)(32*d)); |
709 |
> |
sprintf(op, " -ar %d", (int)(64*d)); |
710 |
|
op += strlen(op); |
711 |
|
sprintf(op, " -ms %.2g", asz/80.); |
712 |
|
op += strlen(op); |
718 |
|
else |
719 |
|
op = addarg(op, "-ds .3"); |
720 |
|
op = addarg(op, "-dt .1 -dc .5 -dr 1 -sj .7 -st .1"); |
721 |
< |
if (overture = vint(INDIRECT)) { |
721 |
> |
if ( (overture = vint(INDIRECT)) ) { |
722 |
|
sprintf(op, " -ab %d", overture); |
723 |
|
op += strlen(op); |
724 |
|
} |
729 |
|
overture = 0; |
730 |
|
switch (vscale(VARIABILITY)) { |
731 |
|
case LOW: |
732 |
< |
op = addarg(op, "-aa .25 -ad 196 -as 0"); |
732 |
> |
op = addarg(op, "-aa .2 -ad 329 -as 42"); |
733 |
|
break; |
734 |
|
case MEDIUM: |
735 |
< |
op = addarg(op, "-aa .2 -ad 400 -as 64"); |
735 |
> |
op = addarg(op, "-aa .15 -ad 800 -as 128"); |
736 |
|
break; |
737 |
|
case HIGH: |
738 |
< |
op = addarg(op, "-aa .15 -ad 768 -as 196"); |
738 |
> |
op = addarg(op, "-aa .1 -ad 1536 -as 392"); |
739 |
|
break; |
740 |
|
} |
741 |
|
d = ambval(); |
742 |
|
sprintf(op, " -av %.2g %.2g %.2g", d, d, d); |
743 |
|
op += strlen(op); |
744 |
< |
op = addarg(op, "-lr 6 -lw .002"); |
744 |
> |
op = addarg(op, "-lr 8 -lw .002"); |
745 |
|
if (vdef(RENDER)) |
746 |
|
op = addarg(op, vval(RENDER)); |
747 |
|
} |
759 |
|
&siz[0], &org[1], &siz[1], &org[2], &siz[2]) != 6) |
760 |
|
badvalue(ZONE); |
761 |
|
siz[0] -= org[0]; siz[1] -= org[1]; siz[2] -= org[2]; |
762 |
< |
if (siz[0] <= FTINY | siz[1] <= FTINY | siz[2] <= FTINY) |
762 |
> |
if ((siz[0] <= FTINY) | (siz[1] <= FTINY) | (siz[2] <= FTINY)) |
763 |
|
badvalue(ZONE); |
764 |
|
getoctcube(org, &d); |
765 |
|
asz = (siz[0]+siz[1]+siz[2])/3.; |
768 |
|
case LOW: |
769 |
|
po = addarg(po, vbool(PENUMBRAS) ? "-ps 1" : "-ps 8"); |
770 |
|
op = addarg(op, "-dp 1024"); |
771 |
< |
sprintf(op, " -ar %d", (int)(16*d)); |
771 |
> |
sprintf(op, " -ar %d", (int)(32*d)); |
772 |
|
op += strlen(op); |
773 |
|
sprintf(op, " -ms %.2g", asz/40.); |
774 |
|
op += strlen(op); |
776 |
|
case MEDIUM: |
777 |
|
po = addarg(po, vbool(PENUMBRAS) ? "-ps 1" : "-ps 5"); |
778 |
|
op = addarg(op, "-dp 2048"); |
779 |
< |
sprintf(op, " -ar %d", (int)(32*d)); |
779 |
> |
sprintf(op, " -ar %d", (int)(64*d)); |
780 |
|
op += strlen(op); |
781 |
|
sprintf(op, " -ms %.2g", asz/80.); |
782 |
|
op += strlen(op); |
784 |
|
case HIGH: |
785 |
|
po = addarg(po, vbool(PENUMBRAS) ? "-ps 1" : "-ps 3"); |
786 |
|
op = addarg(op, "-dp 4096"); |
787 |
< |
sprintf(op, " -ar %d", (int)(64*d)); |
787 |
> |
sprintf(op, " -ar %d", (int)(128*d)); |
788 |
|
op += strlen(op); |
789 |
|
sprintf(op, " -ms %.2g", asz/160.); |
790 |
|
op += strlen(op); |
805 |
|
overture = 0; |
806 |
|
switch (vscale(VARIABILITY)) { |
807 |
|
case LOW: |
808 |
< |
op = addarg(op, "-aa .15 -ad 256 -as 0"); |
808 |
> |
op = addarg(op, "-aa .125 -ad 512 -as 64"); |
809 |
|
break; |
810 |
|
case MEDIUM: |
811 |
< |
op = addarg(op, "-aa .125 -ad 512 -as 256"); |
811 |
> |
op = addarg(op, "-aa .1 -ad 1536 -as 768"); |
812 |
|
break; |
813 |
|
case HIGH: |
814 |
< |
op = addarg(op, "-aa .08 -ad 1024 -as 512"); |
814 |
> |
op = addarg(op, "-aa .075 -ad 4096 -as 2048"); |
815 |
|
break; |
816 |
|
} |
817 |
|
d = ambval(); |
907 |
|
upax = 1-'X'+UPPER(vval(UP)[1]); |
908 |
|
else |
909 |
|
upax = 1-'X'+vlet(UP); |
910 |
< |
if (upax < 1 | upax > 3) |
910 |
> |
if ((upax < 1) | (upax > 3)) |
911 |
|
badvalue(UP); |
912 |
|
if (vval(UP)[0] == '-') |
913 |
|
upax = -upax; |
930 |
|
zpos = -1; vs++; |
931 |
|
} |
932 |
|
viewtype = 'v'; |
933 |
< |
if (*vs == 'v' | *vs == 'l' | *vs == 'a' | *vs == 'h' | *vs == 'c') |
933 |
> |
if((*vs == 'v') | (*vs == 'l') | (*vs == 'a') | (*vs == 'h') | (*vs == 'c')) |
934 |
|
viewtype = *vs++; |
935 |
|
cp = viewopts; |
936 |
|
if ((!*vs || isspace(*vs)) && (xpos|ypos|zpos)) { /* got one! */ |
1041 |
|
return(specview(viewselect)); /* standard view? */ |
1042 |
|
} |
1043 |
|
mv = nvalue(VIEWS, n); /* use view n */ |
1044 |
< |
if (vn != NULL & mv != NULL) { |
1044 |
> |
if ((vn != NULL) & (mv != NULL)) { |
1045 |
|
register char *mv2 = mv; |
1046 |
|
if (*mv2 != '-') |
1047 |
|
while (*mv2 && !isspace(*mv2)) |
1069 |
|
goto again; |
1070 |
|
} |
1071 |
|
#endif |
1072 |
< |
copystruct(&vwr, &stdview); |
1072 |
> |
vwr = stdview; |
1073 |
|
sscanview(&vwr, cp=vopts); /* set initial options */ |
1074 |
|
while ((cp = strstr(cp, "-vf ")) != NULL && |
1075 |
|
*atos(buf, sizeof(buf), cp += 4)) { |
1159 |
|
badvalue(REPORT); |
1160 |
|
} |
1161 |
|
/* set up parallel rendering */ |
1162 |
< |
if (nprocs > 1 & !vdef(ZFILE)) { |
1162 |
> |
if ((nprocs > 1) & (!vdef(ZFILE))) { |
1163 |
|
strcpy(rppopt, "-S 1 -PP pfXXXXXX"); |
1164 |
|
pfile = rppopt+9; |
1165 |
|
if (mktemp(pfile) == NULL) |
1264 |
|
mvfile(rawfile, combuf); |
1265 |
|
} else |
1266 |
|
rmfile(rawfile); |
1267 |
< |
finish_process(); /* leave if child */ |
1267 |
> |
finish_process(); /* exit if child */ |
1268 |
|
} |
1269 |
|
wait_process(1); /* wait for children to finish */ |
1270 |
|
if (pfile != NULL) { /* clean up rpict persistent mode */ |
1272 |
|
fp = fopen(pfile, "r"); |
1273 |
|
if (fp != NULL) { |
1274 |
|
if (fscanf(fp, "%*s %d", &pid) != 1 || |
1275 |
< |
kill(pid, 1) == -1) |
1275 |
> |
kill(pid, 1) < 0) |
1276 |
|
unlink(pfile); |
1277 |
|
fclose(fp); |
1278 |
|
} |
1316 |
|
char *fn; |
1317 |
|
{ |
1318 |
|
if (!silent) |
1319 |
< |
#ifdef _WIN32 |
1310 |
< |
printf("\tdel %s\n", fn); |
1311 |
< |
#else |
1312 |
< |
printf("\trm -f %s\n", fn); |
1313 |
< |
#endif |
1319 |
> |
printf("\t%s %s\n", DELCMD, fn); |
1320 |
|
if (!nprocs) |
1321 |
|
return(0); |
1322 |
|
return(unlink(fn)); |
1327 |
|
char *fold, *fnew; |
1328 |
|
{ |
1329 |
|
if (!silent) |
1330 |
< |
#ifdef _WIN32 |
1325 |
< |
printf("\trename %s %s\n", fold, fnew); |
1326 |
< |
#else |
1327 |
< |
printf("\tmv %s %s\n", fold, fnew); |
1328 |
< |
#endif |
1330 |
> |
printf("\t%s %s %s\n", RENAMECMD, fold, fnew); |
1331 |
|
if (!nprocs) |
1332 |
|
return(0); |
1333 |
|
return(rename(fold, fnew)); |
1343 |
|
if (nprocs <= 1) |
1344 |
|
return(0); /* it's us or no one */ |
1345 |
|
if (inchild()) { |
1346 |
< |
fprintf(stderr, "%s: internal error 1 in spawn_process()\n", |
1346 |
> |
fprintf(stderr, "%s: internal error 1 in next_process()\n", |
1347 |
|
progname); |
1348 |
|
quit(1); |
1349 |
|
} |
1380 |
|
status = status>>8 & 0xff; |
1381 |
|
--children_running; |
1382 |
|
if (status != 0) { /* child's problem is our problem */ |
1383 |
< |
if (ourstatus == 0 & children_running > 0) |
1383 |
> |
if ((ourstatus == 0) & (children_running > 0)) |
1384 |
|
fprintf(stderr, "%s: waiting for remaining processes\n", |
1385 |
|
progname); |
1386 |
|
ourstatus = status; |
1400 |
|
int all; |
1401 |
|
{ |
1402 |
|
(void)all; /* no one to wait for */ |
1403 |
+ |
} |
1404 |
+ |
int |
1405 |
+ |
kill(pid, sig) /* win|unix_process.c should also wait and kill */ |
1406 |
+ |
int pid, sig; |
1407 |
+ |
{ |
1408 |
+ |
return 0; |
1409 |
|
} |
1410 |
|
#endif /* ! RHAS_FORK_EXEC */ |
1411 |
|
|