| 9 |
|
|
| 10 |
|
#include <ctype.h> |
| 11 |
|
#include <time.h> |
| 12 |
+ |
#include <signal.h> |
| 13 |
|
|
| 14 |
|
#include "platform.h" |
| 15 |
|
#include "rtprocess.h" |
| 17 |
|
#include "paths.h" |
| 18 |
|
#include "vars.h" |
| 19 |
|
|
| 20 |
< |
#ifdef _WIN32 |
| 20 |
> |
#if defined(_WIN32) || defined(_WIN64) |
| 21 |
|
#define DELCMD "del" |
| 22 |
|
#define RENAMECMD "rename" |
| 23 |
|
#else |
| 556 |
|
return; |
| 557 |
|
/* make octree0 */ |
| 558 |
|
if ((oct0date < scenedate) | (oct0date < illumdate)) { |
| 559 |
< |
if (touchonly && oct0date) |
| 560 |
< |
touch(oct0name); |
| 561 |
< |
else { /* build command */ |
| 559 |
> |
if (touchonly && (oct0date || oct1date)) { |
| 560 |
> |
if (oct0date) |
| 561 |
> |
touch(oct0name); |
| 562 |
> |
} else { /* build command */ |
| 563 |
|
if (octreedate) |
| 564 |
|
sprintf(combuf, "%s%s -i %s %s > %s", c_oconv, |
| 565 |
|
ocopts, vval(OCTREE), |
| 584 |
|
oct0date = octreedate; |
| 585 |
|
if (oct0date < illumdate) /* ditto */ |
| 586 |
|
oct0date = illumdate; |
| 587 |
< |
} |
| 587 |
> |
} |
| 588 |
|
if (touchonly && oct1date) |
| 589 |
|
touch(oct1name); |
| 590 |
|
else { |
| 646 |
|
for (cp = combuf; *cp; cp++) |
| 647 |
|
; |
| 648 |
|
mkpmapopts(cp); |
| 649 |
+ |
/* force file overwrite */ |
| 650 |
+ |
cp = addarg(cp, "-fo+"); |
| 651 |
|
if (vdef(REPORT)) { |
| 652 |
|
char errfile[256]; |
| 653 |
|
int n; |
| 661 |
|
badvalue(REPORT); |
| 662 |
|
} |
| 663 |
|
if (pgmapname != NULL && pgmapdate < oct1date) { |
| 660 |
– |
if (pgmapdate) |
| 661 |
– |
rmfile(pgmapname); |
| 664 |
|
cp = addarg(cp, "-apg"); |
| 665 |
|
addarg(cp, vval(PGMAP)); |
| 666 |
|
cp = sskip(sskip(cp)); /* remove any bandwidth */ |
| 667 |
|
*cp = '\0'; |
| 668 |
|
} |
| 669 |
|
if (pcmapname != NULL && pcmapdate < oct1date) { |
| 668 |
– |
if (pcmapdate) |
| 669 |
– |
rmfile(pcmapname); |
| 670 |
|
cp = addarg(cp, "-apc"); |
| 671 |
|
addarg(cp, vval(PCMAP)); |
| 672 |
|
cp = sskip(sskip(cp)); /* remove any bandwidth */ |
| 753 |
|
{ |
| 754 |
|
/* BEWARE: This may be called via setdefaults(), so no assumptions */ |
| 755 |
|
|
| 756 |
< |
*mo = '\0'; |
| 756 |
> |
if (nprocs > 1) |
| 757 |
> |
sprintf(mo, " -n %d", nprocs); |
| 758 |
> |
else |
| 759 |
> |
*mo = '\0'; |
| 760 |
|
if (!vdef(MKPMAP)) |
| 761 |
|
return; |
| 762 |
|
if (vval(MKPMAP)[0] != '-') { |
| 810 |
|
{ |
| 811 |
|
char pmapf[256], *bw; |
| 812 |
|
|
| 813 |
+ |
if (vdef(PGMAP)) { |
| 814 |
+ |
*op = '\0'; |
| 815 |
+ |
bw = sskip2(vval(PGMAP), 2); |
| 816 |
+ |
atos(pmapf, sizeof(pmapf), vval(PGMAP)); |
| 817 |
+ |
op = addarg(addarg(op, "-ap"), pmapf); |
| 818 |
+ |
if (atoi(bw) > 0) op = addarg(op, bw); |
| 819 |
+ |
} |
| 820 |
|
switch(vscale(QUALITY)) { |
| 821 |
|
case LOW: |
| 822 |
|
lowqopts(op, po); |
| 828 |
|
hiqopts(op, po); |
| 829 |
|
break; |
| 830 |
|
} |
| 821 |
– |
if (vdef(PGMAP)) { |
| 822 |
– |
bw = sskip2(vval(PGMAP), 2); |
| 823 |
– |
atos(pmapf, sizeof(pmapf), vval(PGMAP)); |
| 824 |
– |
op = addarg(addarg(op, "-ap"), pmapf); |
| 825 |
– |
if (atoi(bw) > 0) op = addarg(op, bw); |
| 826 |
– |
} |
| 831 |
|
if (vdef(PCMAP)) { |
| 832 |
|
bw = sskip2(vval(PCMAP), 2); |
| 833 |
|
atos(pmapf, sizeof(pmapf), vval(PCMAP)); |
| 834 |
|
op = addarg(addarg(op, "-ap"), pmapf); |
| 835 |
|
if (atoi(bw) > 0) op = addarg(op, bw); |
| 836 |
|
} |
| 837 |
< |
if (vdef(RENDER)) |
| 837 |
> |
if (vdef(RENDER)) { |
| 838 |
|
op = addarg(op, vval(RENDER)); |
| 839 |
+ |
bw = strstr(vval(RENDER), "-aa "); |
| 840 |
+ |
if (bw != NULL && atof(bw+4) <= FTINY) |
| 841 |
+ |
overture = 0; |
| 842 |
+ |
} |
| 843 |
|
if (rvdevice != NULL) { |
| 844 |
< |
if (vdef(RVU)) |
| 844 |
> |
if (vdef(RVU)) { |
| 845 |
|
if (vval(RVU)[0] != '-') { |
| 846 |
|
atos(c_rvu, sizeof(c_rvu), vval(RVU)); |
| 847 |
|
po = addarg(po, sskip2(vval(RVU), 1)); |
| 848 |
|
} else |
| 849 |
|
po = addarg(po, vval(RVU)); |
| 850 |
+ |
} |
| 851 |
|
} else { |
| 852 |
< |
if (vdef(RPICT)) |
| 852 |
> |
if (vdef(RPICT)) { |
| 853 |
|
if (vval(RPICT)[0] != '-') { |
| 854 |
|
atos(c_rpict, sizeof(c_rpict), vval(RPICT)); |
| 855 |
|
po = addarg(po, sskip2(vval(RPICT), 1)); |
| 856 |
|
} else |
| 857 |
|
po = addarg(po, vval(RPICT)); |
| 858 |
+ |
} |
| 859 |
|
} |
| 860 |
|
} |
| 861 |
|
|
| 1082 |
|
} |
| 1083 |
|
|
| 1084 |
|
|
| 1085 |
< |
#ifdef _WIN32 |
| 1085 |
> |
#if defined(_WIN32) || defined(_WIN64) |
| 1086 |
|
static void |
| 1087 |
|
setenv( /* set an environment variable */ |
| 1088 |
|
char *vname, |
| 1129 |
|
syserr(vval(OPTFILE)); |
| 1130 |
|
sprintf(ro, " @%s", vval(OPTFILE)); |
| 1131 |
|
} |
| 1132 |
< |
#ifdef _WIN32 |
| 1132 |
> |
#if defined(_WIN32) || defined(_WIN64) |
| 1133 |
|
else if (n > 50) { |
| 1134 |
|
setenv("ROPT", ro+1); |
| 1135 |
|
strcpy(ro, " $ROPT"); |
| 1156 |
|
po = addarg(po, "-m .25"); |
| 1157 |
|
break; |
| 1158 |
|
} |
| 1159 |
< |
if (vdef(PFILT)) |
| 1159 |
> |
if (vdef(PFILT)) { |
| 1160 |
|
if (vval(PFILT)[0] != '-') { |
| 1161 |
|
atos(c_pfilt, sizeof(c_pfilt), vval(PFILT)); |
| 1162 |
|
po = addarg(po, sskip2(vval(PFILT), 1)); |
| 1163 |
|
} else |
| 1164 |
|
po = addarg(po, vval(PFILT)); |
| 1165 |
+ |
} |
| 1166 |
|
} |
| 1167 |
|
|
| 1168 |
|
|
| 1307 |
|
if (cp == viewopts) /* append any additional options */ |
| 1308 |
|
vs++; /* skip prefixed space if unneeded */ |
| 1309 |
|
strcpy(cp, vs); |
| 1310 |
< |
#ifdef _WIN32 |
| 1310 |
> |
#if defined(_WIN32) || defined(_WIN64) |
| 1311 |
|
if (strlen(viewopts) > 40) { |
| 1312 |
|
setenv("VIEW", viewopts); |
| 1313 |
|
return("$VIEW"); |
| 1353 |
|
} |
| 1354 |
|
numview: |
| 1355 |
|
mv = nvalue(VIEWS, n); /* use view n */ |
| 1356 |
< |
if ((vn != NULL) & (mv != NULL)) |
| 1356 |
> |
if ((vn != NULL) & (mv != NULL)) { |
| 1357 |
|
if (*mv != '-') { |
| 1358 |
|
char *mv2 = mv; |
| 1359 |
|
while (*mv2 && !isspace(*mv2)) |
| 1361 |
|
*vn = '\0'; |
| 1362 |
|
} else |
| 1363 |
|
sprintf(vn, "%d", n+1); |
| 1364 |
< |
|
| 1364 |
> |
} |
| 1365 |
|
return(specview(mv)); |
| 1366 |
|
} |
| 1367 |
|
|
| 1375 |
|
VIEW vwr; |
| 1376 |
|
char buf[128]; |
| 1377 |
|
char *cp; |
| 1378 |
< |
#ifdef _WIN32 |
| 1378 |
> |
#if defined(_WIN32) || defined(_WIN64) |
| 1379 |
|
/* XXX Should we allow something like this for all platforms? */ |
| 1380 |
|
/* XXX Or is it still required at all? */ |
| 1381 |
|
again: |
| 1382 |
|
#endif |
| 1383 |
|
if (vopts == NULL) |
| 1384 |
|
return(-1); |
| 1385 |
< |
#ifdef _WIN32 |
| 1385 |
> |
#if defined(_WIN32) || defined(_WIN64) |
| 1386 |
|
if (vopts[0] == '$') { |
| 1387 |
|
vopts = getenv(vopts+1); |
| 1388 |
|
goto again; |
| 1529 |
|
fprintf(stderr, "%s: cannot create\n", pfile); |
| 1530 |
|
quit(1); |
| 1531 |
|
} |
| 1532 |
+ |
pfile[-5] = '\0'; |
| 1533 |
|
pfile = NULL; |
| 1534 |
|
} |
| 1535 |
|
} |